package procsim;

import java.util.*;

public class Design {
    //One & Zero Signals
    public static GSignal zero = new GSignal(0, "0", true);
    public static GSignal one = new GSignal(1, "1", true);
    public static GMSignal ff8 = new GMSignal(8, 0xff);
    public static GMSignal zero8 = new GMSignal(8, 0x0);
    public static GMSignal one8 = new GMSignal(8, 0x1);
    public static GMSignal zero16 = new GMSignal(16, 0x0);

    //**************** TAB CPU ****************//
    public static ClickableElement CPU, OperUnit, ContrUnit, BlockMemory;
    public static ClickableElement BlockRegs, BlockInterface, BlockOper, BlockInterrupt;
    public static GBus DBUS, ABUS, RDBUS, WRBUS, BUSYBUS;

    //***************** TAB IF ****************//
    public static GRegister IR_1, IR_2, IR_3, IR_4;
    public static GAND IFAND1, IFAND2;
    public static GOR IFOR1, IFOR2, IFOR3, IFOR4, IFOR5, IFOR6;
    public static GDecoder IFDC1, IFDC2;
    public static GInverter IFInv1, IFInv2, IFInv3;
    public static GMSignal MDRout, IR31_24, IR23_16, IR15_8, IR7_0;
    public static GMSignal IFDC1out, IFDC2out;
    public static GSignal ldIR1, ldIR2, ldIR3, ldIR4;
    public static GSignal IR31, IR30, IR29, IR23, IR22, IR17, IR16;
    public static GSignal regdir, regind, regindpom, rest, memdir, memind, rel, imm;
    public static GSignal regip, mem, immreg, L1, L2, L3, L3in1, L2in3;
    public static GSignal IR31not1, IR31not2, IR29not1;

    //***************** TAB ID ****************//
    public static GDecoder IDDC1, IDDC2, IDDC3, IDDC4;
    public static GAND IDAND1, IDAND2, IDAND3, IDAND4, IDAND5, IDAND6, IDAND7, IDAND8;
    public static GAND IDAND9, IDAND10, IDAND11, IDAND12, IDAND13, IDAND14, IDAND15;
    public static GOR IDOR1, IDOR2, IDOR3, IDOR4, IDOR5, IDOR6, IDOR7;
    public static GOR IDOR8, IDOR9, IDOR10, IDOR11, IDOR12, IDOR13;
    public static GInverter IDInv1, IDInv2, IDInv3, IDInv4, IDInv5, IDInv6, IDInv7, IDInv8, IDInv9;
    public static GMSignal IDDC1out, IDDC2out, IDDC3out, IDDC4out;
    public static GSignal IR28, IR27, IR26, IR25, IR24, IR21, IR20, IR19;
    public static GSignal NOP, RTS, RTI, INTE, INTD, TRPE, TRPD, HALT, JMP, INT, JSR, BNZ;
    public static GSignal ASR, PUSH, POP, INC, DEC, JMPIND, MOVS, MOVD, ADD, AND;
    public static GSignal IDDC2out0, IDDC2out1, IDDC2out2, IDDC2out3;
    public static GSignal IDDC3out5, IDDC3out6, IDDC3out7, IDDC4out0, IDDC4out5, IDDC4out6, IDDC4out7;
    public static GSignal IDAND1out, IDAND6out, IDAND7out, IDAND8out, IDAND9out, IDAND10out;
    public static GSignal IDAND11out, IDAND12out, IDAND13out, IDAND14out, IDAND15out;
    public static GSignal IDOR1out, IDOR2out, IDOR3out, IDOR4out, IDOR6out, IDOR7out;
    public static GSignal IDOR8out, IDOR9out, IDOR10out, IDOR12out, grADR, grOPR;
    public static GSignal IR31not3, IR31not4, IR31not5, IR29not2, IR29not3, IDAND6outnot, IDOR3outnot, IFL1not1, IFL1not2;

    //**************** TAB Aux ****************//
    public static GAND AuxAND1, AuxAND2, AuxAND3, AuxAND4, AuxAND5;
    public static GOR AuxOR1, AuxOR2, AuxOR3, AuxOR4, AuxOR5, AuxOR6;
    public static GSignal CTRL, OJO, ODO, NAD, NAD2, OJO2, ODO2, MOVS2, PUSH2, JMPIND2, grADROPR;

    //************** TAB MAR MDR **************//
    public static GRegister MDR;
    public static GCounter MAR;
    public static GMMultiplexer mxMAR, mxMDR;
    public static GTriState TSRDBUS, TSWRBUS;
    public static GMTriState TSMAR, TSMDR;
    public static GAND MDRbusAND, rdbusAND, wrbusAND;
    public static GOR MDROR;
    public static GMSignal PCout, SPout, DISPout, ADRIVTout, Xout, TEMPDISPout, TEMPout; //mxMAR signali
    public static GMSignal PSWout, DBUSout, PCoutH, PCoutL, TEMPoutH, TEMPoutL, XHout, YHout; //mxMDR signali
    public static GMSignal mxMARout, mxMDRout, MARout, MARbus, MDRbus, REGout; // MDRout vec definisan
    public static GMSignal rdbus, wrbus;
    public static GSignal busHOLD, write, read, MDRbusANDout, rdbusANDout, wrbusANDout;
    public static GSignal rd, wr, ldMAR, incMAR, stopRD, ldMDR, MDRORout;
    public static GSignal mxMAR0, mxMAR1, mxMAR2, mxMDR0, mxMDR1, mxMDR2;
    public static GSignal REGout1, REGout2, REGout3;
    
    //********** TAB ALU indicators ***********//
    public static GAND AIAND1, AIAND2, AIAND3, AIAND4, AIAND5, AIAND6, AIAND7, AIAND8;
    public static GOR AIOR1, AIOR2, AIOR3, AIOR4, AIOR5;
    public static GInverter AIInv1, AIInv2, AIInv3, AIInv4, AIInv5, AIInv6;
    public static GMSignal Yout, Fout;
    public static GSignal F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15;
    public static GSignal C16, X0, X15, Y15, C16not, F15not1, X15not1, Y15not, X15not2, F15not2;
    public static GSignal aluN, aluC, aluV, aluZ, AIOR1out, AIOR3out;
    public static GSignal AIAND1out, AIAND2out, AIAND3out, AIAND4out, AIAND5out, AIAND6out, AIAND7out, AIAND8out;

    //**************** TAB IMR ****************//
    public static GOR IMROR;
    public static GAND IMRAND1, IMRAND2, IMRAND3, IMRAND4, IMRAND5, IMRAND6, IMRAND7, IMRAND8;
    public static GInverter IMRInv1, IMRInv2, IMRInv3;
    public static GRSFlipFlop IMRRS1, IMRRS2, IMRRS3, PRINTRS, PRADRRS, PROPRRS;
    public static GSignal ldCONTROL, STIMR, stPRINT, ackPRINT, ldPRADROPR, ackADR, ackOPR;
    public static GSignal IMR1, IMR2, IMR3, PRINT, PRADR, PROPR;
    public static GSignal IMRORout, IMRAND1out, IMRAND2out, IMRAND3out, IMRAND4out, IMRAND5out;
    public static GSignal IMRAND6out, IMRAND7out, IMRAND8out, REGout1not, REGout2not, REGout3not;

    //*************** TAB Sync ****************//
    public static GDFlipFlop SyncD1, SyncD2, SyncD3;
    public static GCounter SyncCNT;
    public static GInverter SyncInv1, SyncInv2;
    public static GAND SyncAND1, SyncAND2, SyncAND3, SyncAND4, SyncAND5, SyncAND6, SyncAND7, SyncAND8;
    public static GOR SyncOR1, SyncOR2, SyncOR3, SyncOR4, SyncOR5;
    public static GMSignal SyncCNTin, SyncCNTout;
    public static GSignal DRD, DWR, brqSTART, brqSTOP, run, stopWR;
    public static GSignal SyncAND1out, SyncAND3out, SyncOR1out, SyncD1Qcompl, SyncD2Qcompl, SyncD3Qcompl;
    public static GSignal SyncCNTout0, SyncCNTout1, SyncCNTout2, SyncCNTout1not, SyncCNTout2not;
    public static GSignal SyncOR2out, SyncAND6out, SyncOR4out;

    //**************** TAB ALU ****************//
    public static GALU ALU;
    public static GRegister TEMP;
    public static GRSFlipFlop ALURS;
    public static GAND ALUAND1, ALUAND2, ALUAND3, ALUAND4, ALUAND5, ALUAND6;
    public static ClickableElement ALUCE;
    public static GSignal aluOJO, aluODO, aluADD, aluAND, aluINC, aluDEC, aluASR, transX;
    public static GSignal halt, haltCompl, ldTEMP, ALUANDout;

    //**************** TAB PC *****************//
    public static GCounter PC;
    public static GRegister PCH, PCL, ADRTMP;
    public static GMMultiplexer PCHMP, PCLMP;
    public static GMSignal ADRTMPout, DISPH, DISPL, ADRTMPH, ADRTMPL;
    public static GMSignal PCHMPout, PCLMPout, PCHout, PCLout, PCin;
    public static GSignal mxPC0, mxPC1, mxPC2;
    public static GSignal ldPCH, ldPCL, ldPC, incPC, ldADRTMP;
    
    //**************** TAB XY *****************//
    public static GMMultiplexer XYMP1, XYMP2, XYMP3;
    public static GRegister XH, XL, YH, YL;
    public static GOR XYOR1, XYOR2;
    public static GAND XYAND;
    public static GInverter XYInv;
    public static GMSignal OPR, OPRH, OPRL, XYMP2out, XYMP3out, XLout, YLout, IR15_0;
    public static GSignal ldXH, ldYH, ldXL, ldYL, XYOR1out, XYOR2out, XYANDout, R6not;
    
    //*************** TAB DISP ****************//
    public static GMMultiplexer DISPMP1, DISPMP2, DISPMP3, DISPMP4;
    public static GAdder DISPADD;
    public static GAND DISPAND1, DISPAND2;
    public static GOR DISPOR1, DISPOR2, DISPOR3;
    public static GRegister TEMPDISP;
    public static GMSignal DISPMP1out, DISPMP2out, DISPMP3in, DISPMP3out, DISPMP4out;
    public static GSignal DISPOR1out, DISPOR2out, DISPOR3out, DISPAND1out, DISPAND2out, IR15, ldTD;
    
    //*********** TAB Registers, 1 ************//
    public static GMMultiplexer Reg1MP1, Reg1MP2, Reg1MP3, Reg1MP4, Reg1MP5;
    public static GDecoder Reg1DC;
    public static GEncoder Reg1CD;
    public static GMSignal one3, five3, six3, seven3, IR21_19, IR18_16;
    public static GMSignal Reg1MP1out, Reg1DCout, Reg1CDout, Reg1MP2out, Reg1MP3out, regsel, regIN;
    public static GSignal Reg1DCout0, Reg1DCout1, Reg1DCout2, Reg1DCout3, bpdi, bpsi, bxdi, bxsi;
    public static GSignal R0, R1, R2, R3, R4, R5, R6, IR18;

    //*********** TAB Registers, 2 ************//
    public static GDecoder Reg2DC;
    public static GMMultiplexer Reg2MP1, Reg2MP2;
    public static GAdder Reg2ADD;
    public static GOR RegOR;
    public static GRegister RegTMP, AX, BX, CX, DX, BP, SI, DI;
    public static GCounter SP;
    public static GMSignal AXout, BXout, CXout, DXout, BPout, SIout, DIout;
    public static GMSignal Reg2DCout, Reg2MP1out, TMPout, Reg2ADDout;
    public static GSignal Reg2DCout0, Reg2DCout1, Reg2DCout2, Reg2DCout3, Reg2DCout4, Reg2DCout5, Reg2DCout6, Reg2DCout7;
    public static GSignal ldSP, RegORout, ldTM, R7, regsel0, regsel1, regsel2, ldREG, incSP, decSP;

    //***************** TAB Masked Interrupts ****************//
    //Signals
    public static GMSignal IMRout, PRPERout;
    public static GSignal PRPER1, PRPER2, PRPER3, PRPER;
    public static GMSignal MIA, MIB;
    //Result Signals
    public static GSignal MILeftResult, MIMiddleResult, MIRightResult, MIFarRightResult;
    public static GSignal MIOrResult;
    public static GSignal MIComparatorG, MIComparatorL, MIComparatorE;
    public static GMSignal MICoderOut;
    //Logical elements
    public static GAND MILeft, MIMiddle, MIRight, MIFarRight;
    public static GOR MIOr;
    //Other
    public static GComparator MIComparator;
    public static GEncoder MICoder;

    //***************** TAB Masked InterruptsACK ****************//
    //Flip-flops and registers
    public static GRSFlipFlop MIARSLeft1, MIARSRight1, MIARSLeft2, MIARSRight2, MIARSLeft3, MIARSRight3, MIARSLeft4, MIARSRight4;
    //Logical elements
    public static GAND MIAAnd1, MIAAnd2, MIAAnd3, MIAAnd4;
    //Signals
    public static GSignal inm, ackPRINM, intr3, ackPER3, intr2, ackPER2, intr1, ackPER1, Finm, Fintr3, Fintr2,Fintr1, ldINTEXT, PRINM;
    //Resulting Signals
    public static GSignal MIAAnd1Result, MIAAnd2Result, MIAAnd3Result, MIAAnd4Result;

    //***************** TAB Interrupts ****************//
    //Others
    public static GRegister IVTP;
    public static GEncoder ICoder;
    public static GDecoder IDecoder;
    public static GMMultiplexer IMMP1, IMMP2;
    public static GAdder IAdd;
    //Logical Elements
    public static GOR IOrUpper, IOrLower;
    public static GAND IAnd1, IAnd2, IAnd3;
    //Signals
    public static GSignal IDecoderOut0, IDecoderOut4, ICoderW, ackINT, IMMP1Out0, IMMP1Out1, ICoderOut0, ICoderOut1, IMMP1S0, IOrLowerResult, PREKIDCompl, ackPRADR, ackPROPR;
    public static GMSignal IDecoderOut, IMMP1Out, IMMP2In, IMMP2Out, Seven0, Five0, IMMP1in0, IMMP1in1, ADRIVT, IADDin1, IVTPout;

    //***************** TAB Arbitrator ****************//
    //Flip-flops and registers
    public static GRSFlipFlop ARSLeft, ARSRight;
    //Logical elements
    public static GAND AAndLeft, AAndRight;
    public static GInverter AInverter;
    public static GTriState ATriStateRight;
    public static GMTriState ATriStateLeft1, ATriStateLeft2;
    public static GOR AOr;
    //Signals
    public static GSignal bSTART, BRQ0, BRQ1, BRQ2, BRQ3, BG0, BG1, BG2, BG3;
    //Resulting Signals
    public static GSignal ATriStateLeft1Result;
    public static GMSignal ATriStateRightResult, ATriStateLeft2Result, ATriStateLeft1MResult;
    public static GSignal AAndLeftResult, AOrResult, AInverterResult;
    public static GMSignal ACoderOut, ADecoderOut;
    public static GSignal ACoderOut0, ACoderOut1, ACoderW;
    //Others
    public static GEncoder ACoder;
    public static GDecoder ADecoder;
    
    //***************** TAB PSW 1 ****************//
    //Signals
    public static GSignal ack, ldPSWL, prL0, prL1, MDR4, MDR5, MDR6, MDR7, PSWin, PSWL0, PSWL1, PSWT, PSWI, stPSWT, clPSWT, stPSWI, clPSWI;
    //Result Signals
    public static GSignal PSW1And1Result, PSW1And2Result, PSW1And3Result, PSW1And4Result, PSW1And5Result, PSW1And6Result, PSW1And7Result, PSW1And8Result, PSW1And9Result, PSW1And10Result, PSW1And11Result, PSW1And12Result;
    public static GSignal PSW1Or1Result, PSW1Or2Result, PSW1Or3Result, PSW1Or4Result, PSW1Or5Result, PSW1Or6Result, PSW1Or7Result, PSW1Or8Result;
    public static GSignal PSW1Inv1Result, PSW1Inv2Result, PSW1Inv3Result, PSW1Inv4Result, PSW1Inv5Result, PSW1Inv6Result;
    public static GSignal clPSWTAndResult, clPSWIAndResult;
    //Logical elements
    public static GAND PSW1And1, PSW1And2, PSW1And3, PSW1And4, PSW1And5, PSW1And6, PSW1And7, PSW1And8, PSW1And9, PSW1And10, PSW1And11, PSW1And12;
    public static GOR PSW1Or1, PSW1Or2, PSW1Or3, PSW1Or4, PSW1Or5, PSW1Or6, PSW1Or7, PSW1Or8;
    public static GAND clPSWTAnd, stPSWTAnd, clPSWIAnd, stPSWIAnd;
    public static GOR clPSWTOr, clPSWIOr;
    public static GInverter PSW1Inv1, PSW1Inv2, PSW1Inv3, PSW1Inv4, PSW1Inv5, PSW1Inv6;
    //Flip-flops & registers
    public static GRSFlipFlop PSW1RS1, PSW1RS2, PSW1RS3, PSW1RS4;

    //***************** TAB PSW 2 ****************//
    //Signals
    public static GSignal ldFLAGS, MDR0, MDR1, MDR2, MDR3, PSWN, PSWZ, PSWC, PSWV;
    public static GSignal cond;
    //Result Signals
    public static GSignal PSW2And1Result, PSW2And2Result, PSW2And3Result, PSW2And4Result, PSW2And5Result, PSW2And6Result, PSW2And7Result, PSW2And8Result, PSW2And9Result, PSW2And10Result, PSW2And11Result, PSW2And12Result, PSW2And13Result, PSW2And14Result, PSW2And15Result, PSW2And16Result;
    public static GSignal PSW2Or1Result, PSW2Or2Result, PSW2Or3Result, PSW2Or4Result, PSW2Or5Result, PSW2Or6Result, PSW2Or7Result, PSW2Or8Result;
    public static GSignal PSW2Inv1Result, PSW2Inv2Result, PSW2Inv3Result, PSW2Inv4Result, PSW2Inv5Result, PSW2Inv6Result, PSW2Inv7Result, PSW2Inv8Result;
    public static GSignal PSW2CondInvResult;
    //Logical elements
    public static GAND PSW2And1, PSW2And2, PSW2And3, PSW2And4, PSW2And5, PSW2And6, PSW2And7, PSW2And8, PSW2And9, PSW2And10, PSW2And11, PSW2And12, PSW2And13, PSW2And14, PSW2And15, PSW2And16;
    public static GAND PSW2CondAnd;
    public static GOR PSW2Or1, PSW2Or2, PSW2Or3, PSW2Or4, PSW2Or5, PSW2Or6, PSW2Or7, PSW2Or8;
    public static GInverter PSW2Inv1, PSW2Inv2, PSW2Inv3, PSW2Inv4, PSW2Inv5, PSW2Inv6, PSW2Inv7, PSW2Inv8;
    public static GInverter PSW2CondInv;
    //Flip-flops & registers
    public static GRSFlipFlop PSW2RS1, PSW2RS2, PSW2RS3, PSW2RS4;

    //***************** TAB MEM1 ****************//
    //Signals & Result Signals
    public static GMSignal MABusOut, MDBusOut, MRDBusOut, MWRBusOut, MTriState3Out, MTriState2Out, MTriState1Out, DOut, DROut;
    public static GSignal MTriState2out, MTriState1out, ldCNT, MOr2Out, MOr3Out, FRD, FWR, FC, DFC;
    //Logical Elements
    public static GOR MOr1, MOr2, MOr3;
    public static GMTriState MTriState1, MTriState2, MTriState3;
    //Flip-flops and registers
    public static GRSFlipFlop MRS1, MRS2;
    public static GRegister DR;
    //Others
    public static GMemory memory;

    //***************** TAB MEM2 ****************//
    public static GMSignal CNTIn, CNTOut;
    public static GSignal decCNT, CNTOut0, CNTOut1, CNTOut2, M2Or2Out;
    //Logical Elements
    public static GOR M2Or1, M2Or2;
    public static GAND M2And;
    //Flip-flops and registers
    public static GDFlipFlop M2DFF;
    public static GCounter CNT;

    //****************** TAB CU *****************//
    //Signals
    public static GSignal brOPR, CUldCNT, CUincCNT, CUInvOut, branch, CUOrOut;
    //MSignals
    public static GMSignal op, br, CUMPOut, CUCNTOut;
    public static GBigMSignal CUDCOut, CUDCOut169_0;
    //Logical Elements
    public static GAND CUAnd1, CUAnd2;
    public static GOR CUOr;
    public static GInverter CUInv;
    //Flip-flops and Registers
    public static GCounter CUCNT;
    //Others
    public static GMMultiplexer CUMP;
    public static GBigDecoder CUDC;
    public static ClickableElement KMOP, KMBRANCH, CTRLSignalsOP, CTRLSignalsCU;

    /// T Signals
    public static GSignal T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T0A, T0B, T0C, T0D, T0E, T0F, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T1A, T1B, T1C, T1D, T1E, T1F, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T2A, T2B, T2C, T2D, T2E, T2F, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T3A, T3B, T3C, T3D, T3E, T3F, T40, T41, T42, T43, T44, T45, T46, T47, T48, T49, T4A, T4B, T4C, T4D, T4E, T4F, T50, T51, T52, T53, T54, T55, T56, T57, T58, T59, T5A, T5B, T5C, T5D, T5E, T5F, T60, T61, T62, T63, T64, T65, T66, T67, T68, T69, T6A, T6B, T6C, T6D, T6E, T6F, T70, T71, T72, T73, T74, T75, T76, T77, T78, T79, T7A, T7B, T7C, T7D, T7E, T7F, T80, T81, T82, T83, T84, T85, T86, T87, T88, T89, T8A, T8B, T8C, T8D, T8E, T8F, T90, T91, T92, T93, T94, T95, T96, T97, T98, T99, T9A, T9B, T9C, T9D, T9E, T9F, TA0, TA1, TA2, TA3, TA4, TA5, TA6, TA7, TA8, TA9;

    //***************** TAB CUSOP ***************//
    public static GOR OPOR1, OPOR2, OPOR3, OPOR4, OPOR5, OPOR6, OPOR7, OPOR8, OPOR9, OPOR10;
    public static GOR OPOR11, OPOR12, OPOR13, OPOR14, OPOR15, OPOR16, OPOR17, OPOR18, OPOR19;
    public static GOR OPOR20, OPOR21, OPOR22, OPOR23, OPOR24, OPOR25, OPOR26, OPOR27, OPOR28;
    public static GOR OPOR29, OPOR30, OPOR31, OPOR32, OPOR33, OPOR34, OPOR35, OPOR36;
    public static AND OPAND2, OPAND12;
    public static OR OPORrun;
    public static Signal incMAR_, incSP_, run_;

    //***************** TAB CUSCU ***************//
    public static GSignal val00, val0E, val0F, val12, val2B, val3A, val66, val6E, val72, val76, val7A, val7E, val80, val85, val86, val8C, val94, val95, val9A;
    public static GSignal brOPR1, brOPR2, bruncnd, brgrADROPR, brL1, brL2, brL3, brnotPREKID, brnotCOND, condCompl, brnotreg, regCompl, brnotimmreg, immregCompl, brnotmemind, memindCompl, brmemind, brnotregip, regipCompl, brbxsi, brbxdi, brbpsi, brbpdi, brNAD2, brnotNAD, NADCompl;
    public static GSignal SCUAND1Out, SCUAND2Out, SCUAND3Out, SCUAND4Out, SCUAND5Out, SCUAND6Out, SCUAND7Out, SCUAND8Out, SCUAND9Out, SCUAND10Out, SCUAND11Out, SCUAND12Out, SCUAND13Out, SCUAND14Out, SCUAND15Out, SCUAND16Out, SCUAND17Out;
    //Logical Elements
    public static GAND SCUAND1, SCUAND2, SCUAND3, SCUAND4, SCUAND5, SCUAND6, SCUAND7, SCUAND8, SCUAND9, SCUAND10, SCUAND11, SCUAND12, SCUAND13, SCUAND14, SCUAND15, SCUAND16, SCUAND17;
    public static GOR SCOR1, SCOR2, SCOR3, SCOR4, SCOR5, SCOR6, SCOR7, SCOR8, SCOR9, SCOR10, SCOR11, SCOR12, SCOR13, SCOR14, SCOR15;
    public static GInverter SCInv1, SCInv2, SCInv3, SCInv4, SCInv5, SCInv6;

    //**************** TAB CUOPR *****************//
    //Signals
    public static GSignal CUOPRCoderOut0, CUOPRCoderOut1, CUOPRCoderOut2, CUOPRCoderOut3, CUOPRCoderOut4;
    public static GSignal CUOPRAND1out, CUOPRAND2out, CUOPRAND3out, CUOPRAND4out, CUOPRAND5out;
    public static GMSignal v14, v16, v1D, v1F, v24, v28, v2D, v2F, v3C, v45, v53, v59, v5F, v66, vA8, vAA, v34, v3E, v4F, v55, v61;
    public static GMSignal CUOPRCoderOut;
    //Others
    public static GEncoder CUOPRCoder;
    public static GMMultiplexer CUOPRMP;
    public static GAND CUOPRAND1, CUOPRAND2, CUOPRAND3, CUOPRAND4, CUOPRAND5;

    //**************** TAB CUBRANCH *****************//
    //Signals
    public static GSignal CUBRANCHCoderOut0, CUBRANCHCoderOut1, CUBRANCHCoderOut2, CUBRANCHCoderOut3, CUBRANCHCoderOut4;
    public static GMSignal v00, v0E, v0F, v12, v2B, v6E, v72, v76, v7A, v7E, v86, v8C, v94, v95, v3A, v80, v85, v9A;
    public static GMSignal CUBRANCHCoderOut;
    //Others
    public static GEncoder CUBRANCHCoder;
    public static GMMultiplexer CUBRANCHMP;

    //Misc
    public static MSignal[] org1, org2, arch;
    public static Bus[] buses;

    public static void createDesign(){
        createSignals();
        tabCPU();
        tabIF();
        tabID();
        tabAux();
        tabMARMDR();
        tabIndicators();
        tabIMR();
        tabSync();
        tabALU();
        tabPC();
        tabXY();
        tabDISP();
        tabRegisters1();
        tabRegisters2();
        tabPSW1();
        tabPSW2();
        tabMaskedInterrupts();
        tabMaskedInterruptsACK();
        tabArbitrator();
        tabInterrupts();
        tabMEM1();
        tabMEM2();
        tabCTRLUnit1();
        tabCTRLUnit2();
        tabSignalsOP();
        tabSignalsCU();
        tabCUOPR();
        tabCUBRANCH();

        org1 = new MSignal[] {MARout, MDRout, IR31_24, IR23_16, IR15_8, IR7_0};
        org2 = new MSignal[] {PCout, PSWout, IMRout, IVTPout, Xout, Yout};
        arch = new MSignal[] {AXout, BXout, CXout, DXout, SPout, BPout, SIout, DIout};
        buses = new Bus[] {ABUS, DBUS, WRBUS, RDBUS, BUSYBUS};
    }

    private static void createSignals(){
        // CPU
        DBUS = new GBus(8, "DBUS");
        ABUS = new GBus(16, "ABUS");
        RDBUS = new GBus(1, "RDBUS");
        WRBUS = new GBus(1, "WRBUS");
        BUSYBUS = new GBus(1, "BUSY");

        // IF
        MDRout = new GMSignal(8, 0, "MDR", true); // da se poveze sa izlazom MDR-a
        IR31_24 = new GMSignal(8, 0, "IR31..24", true);
        IR23_16 = new GMSignal(8, 0, "IR23..16", true);
        IR15_8 = new GMSignal(8, 0, "IR15..8", true);
        IR7_0 = new GMSignal(8, 0, "IR7..0", true);
        IFDC1out = new GMSignal(4, 0);
        IFDC2out = new GMSignal(4, 0);
        ldIR1 = new GSignal(0, "ldIR1", true);
        ldIR2 = new GSignal(0, "ldIR2", true);
        ldIR3 = new GSignal(0, "ldIR3", true);
        ldIR4 = new GSignal(0, "ldIR4", true);
        IR31 = new GSignal(0, "IR31", true);
        IR30 = new GSignal(0, "IR30", true);
        IR29 = new GSignal(0, "IR29", true);
        IR23 = new GSignal(0, "IR23", true);
        IR22 = new GSignal(0, "IR22", true);
        IR17 = new GSignal(0, "IR17", true);
        IR16 = new GSignal(0, "IR16", true);
        regdir = new GSignal(0, "reg", true);
        regind = new GSignal(0, "regind", true);
        regindpom = new GSignal(0, "regindpom", true);
        rest = new GSignal(0, "rest", false);
        memdir = new GSignal(0, "memdir", true);
        memind = new GSignal(0, "memind", true);
        rel = new GSignal(0, "rel", true);
        imm = new GSignal(0, "imm", true);
        mem = new GSignal(0, "mem", true);
        immreg = new GSignal(0, "immreg", true);
        regip = new GSignal(0, "regip", true);
        L1 = new GSignal(0, "L1", true);
        L2 = new GSignal(0, "L2", true);
        L3 = new GSignal(0, "L3", true);
        L3in1 = new GSignal(0);
        L2in3 = new GSignal(0);
        IR31not1 = new GSignal(0);
        IR31not2 = new GSignal(0);
        IR29not1 = new GSignal(0);

        IR31_24.bindOut(7, IR31);
        IR31_24.bindOut(6, IR30);
        IR31_24.bindOut(5, IR29);
        IR23_16.bindOut(7, IR23);
        IR23_16.bindOut(6, IR22);
        IR23_16.bindOut(1, IR17);
        IR23_16.bindOut(0, IR16);
        IFDC1out.bindOut(0, regdir);
        IFDC1out.bindOut(1, regind);
        IFDC1out.bindOut(2, regindpom);
        IFDC1out.bindOut(3, rest);
        IFDC2out.bindOut(0, memdir);
        IFDC2out.bindOut(1, memind);
        IFDC2out.bindOut(2, rel);
        IFDC2out.bindOut(3, imm);

        // ID
        IDDC1out = new GMSignal(8, 0);
        IDDC2out = new GMSignal(4, 0);
        IDDC3out = new GMSignal(8, 0);
        IDDC4out = new GMSignal(8, 0);
        IR28 = new GSignal(0, "IR28", true);
        IR27 = new GSignal(0, "IR27", true);
        IR26 = new GSignal(0, "IR26", true);
        IR25 = new GSignal(0, "IR25", true);
        IR24 = new GSignal(0, "IR24", true);
        IR21 = new GSignal(0, "IR21", true);
        IR20 = new GSignal(0, "IR20", true);
        IR19 = new GSignal(0, "IR19", true);
        NOP = new GSignal(0, "NOP", true);
        RTS = new GSignal(0, "RTS", true);
        RTI = new GSignal(0, "RTI", true);
        INTE = new GSignal(0, "INTE", true);
        INTD = new GSignal(0, "INTD", true);
        TRPE = new GSignal(0, "TRPE", true);
        TRPD = new GSignal(0, "TRPD", true);
        HALT = new GSignal(0, "HALT", true);
        JMP = new GSignal(0, "JMP", true);
        INT = new GSignal(0, "INT", true);
        JSR = new GSignal(0, "JSR", true);
        BNZ = new GSignal(0, "BNZ", true);
        ASR = new GSignal(0, "ASR", true);
        PUSH = new GSignal(0, "PUSH", true);
        POP = new GSignal(0, "POP", true);
        INC = new GSignal(0, "INC", true);
        DEC = new GSignal(0, "DEC", true);
        JMPIND = new GSignal(0, "JMPIND", true);
        MOVS = new GSignal(0, "MOVS", true);
        MOVD = new GSignal(0, "MOVD", true);
        ADD = new GSignal(0, "ADD", true);
        AND = new GSignal(0, "AND", true);
        IDDC2out1 = new GSignal(0);
        IDDC2out2 = new GSignal(0);
        IDDC2out3 = new GSignal(0);
        IDDC2out0 = new GSignal(0);
        IDDC3out5 = new GSignal(0);
        IDDC3out6 = new GSignal(0);
        IDDC3out7 = new GSignal(0);
        IDDC4out0 = new GSignal(0);
        IDDC4out5 = new GSignal(0);
        IDDC4out6 = new GSignal(0);
        IDDC4out7 = new GSignal(0);
        IDAND1out = new GSignal(0);
        IDAND6out = new GSignal(0);
        IDAND7out = new GSignal(0);
        IDAND8out = new GSignal(0);
        IDAND9out = new GSignal(0);
        IDAND10out = new GSignal(0);
        IDAND11out = new GSignal(0);
        IDAND12out = new GSignal(0);
        IDAND13out = new GSignal(0);
        IDAND14out = new GSignal(0);
        IDAND15out = new GSignal(0);
        IDOR1out = new GSignal(0);
        IDOR2out = new GSignal(0);
        IDOR3out = new GSignal(0);
        IDOR4out = new GSignal(0);
        IDOR6out = new GSignal(0);
        IDOR7out = new GSignal(0);
        IDOR8out = new GSignal(0);
        IDOR9out = new GSignal(0);
        IDOR10out = new GSignal(0);
        IDOR12out = new GSignal(0);
        grADR = new GSignal(0, "grADR", true);
        grOPR = new GSignal(0, "grOPR", true);
        IR31not3 = new GSignal(0);
        IR31not4 = new GSignal(0);
        IR31not5 = new GSignal(0);
        IR29not2 = new GSignal(0);
        IR29not3 = new GSignal(0);
        IDAND6outnot = new GSignal(0);
        IDOR3outnot = new GSignal(0);
        IFL1not1 = new GSignal(0);
        IFL1not2 = new GSignal(0);
        
        IR31_24.bindOut(4, IR28);
        IR31_24.bindOut(3, IR27);
        IR31_24.bindOut(2, IR26);
        IR31_24.bindOut(1, IR25);
        IR31_24.bindOut(0, IR24);
        IR23_16.bindOut(5, IR21);
        IR23_16.bindOut(4, IR20);
        IR23_16.bindOut(3, IR19);
        IDDC1out.bindOut(0, NOP);
        IDDC1out.bindOut(1, RTS);
        IDDC1out.bindOut(2, RTI);
        IDDC1out.bindOut(3, INTE);
        IDDC1out.bindOut(4, INTD);
        IDDC1out.bindOut(5, TRPE);
        IDDC1out.bindOut(6, TRPD);
        IDDC1out.bindOut(7, HALT);
        IDDC2out.bindOut(0, IDDC2out0);
        IDDC2out.bindOut(1, IDDC2out1);
        IDDC2out.bindOut(2, IDDC2out2);
        IDDC2out.bindOut(3, IDDC2out3);
        IDDC3out.bindOut(0, PUSH);
        IDDC3out.bindOut(1, POP);
        IDDC3out.bindOut(2, INC);
        IDDC3out.bindOut(3, DEC);
        IDDC3out.bindOut(4, JMPIND);
        IDDC3out.bindOut(5, IDDC3out5);
        IDDC3out.bindOut(6, IDDC3out6);
        IDDC3out.bindOut(7, IDDC3out7);
        IDDC4out.bindOut(0, IDDC4out0);
        IDDC4out.bindOut(1, MOVS);
        IDDC4out.bindOut(2, MOVD);
        IDDC4out.bindOut(3, ADD);
        IDDC4out.bindOut(4, AND);
        IDDC4out.bindOut(5, IDDC4out5);
        IDDC4out.bindOut(6, IDDC4out6);
        IDDC4out.bindOut(7, IDDC4out7);

        // Aux
        CTRL = new GSignal(0, "CTRL", true);
        OJO = new GSignal(0, "OJO", true);
        ODO = new GSignal(0, "ODO", true);
        NAD = new GSignal(0, "NAD", true);
        NAD2 = new GSignal(0, "NAD2", true);
        OJO2 = new GSignal(0, "OJO2", true);
        ODO2 = new GSignal(0, "ODO2", true);
        MOVS2 = new GSignal(0, "MOVS2", true);
        PUSH2 = new GSignal(0, "PUSH2", true);
        JMPIND2 = new GSignal(0, "JMPIND2", true);
        grADROPR = new GSignal(0, "grADROPR", true);

        // MARMDR
        XHout = new GMSignal(8, 0, "X15..8", true);
        XLout = new GMSignal(8, 0, "X7..0", true);
        Xout = new GMSignal(16, 0, "X", true);
        TEMPDISPout = new GMSignal(16, 0, "TEMPDISP", true);
        DISPout = new GMSignal(16, 0, "DISP", true);
        SPout = new GMSignal(16, 0, "SP", true);
        PCout = new GMSignal(16, 0, "PC", true);
        ADRIVTout = new GMSignal(16, 0, "ADRIVT", true);
        TEMPout = new GMSignal(16, 0, "TEMP", true);
        REGout = new GMSignal(16, 0, "regOUT", true);
        PSWout = new GMSignal(8, 0, "PSW", true);
        DBUSout = new GMSignal(8, 0, "DBUS", true);
        PCoutH = new GMSignal(8, 0, "PC15..8", true);
        PCoutL = new GMSignal(8, 0, "PC7..0", true);
        TEMPoutH = new GMSignal(8, 0, "TEMP15..8", true);
        TEMPoutL = new GMSignal(8, 0, "TEMP7..0", true);
        mxMARout = new GMSignal(16, 0);
        mxMDRout = new GMSignal(8, 0);
        MARout = new GMSignal(16, 0, "MAR", true);
        MARbus = new GMSignal(16, 0);
        MDRbus = new GMSignal(8, 0);
        rdbus = new GMSignal(1, 0);
        wrbus = new GMSignal(1, 0);
        busHOLD = new GSignal(0, "busHOLD", true);
        write = new GSignal(0, "write", true);
        read = new GSignal(0, "read", true);
        MDRbusANDout = new GSignal(0);
        rdbusANDout = new GSignal(0);
        wrbusANDout = new GSignal(0);
        rd = new GSignal(0, "rd", true);
        wr = new GSignal(0, "wr", true);
        ldMAR = new GSignal(0, "ldMAR", true);
        incMAR = new GSignal(0, "incMAR", true);
        stopRD = new GSignal(0, "stopRD", true);
        ldMDR = new GSignal(0, "ldMDR", true);
        MDRORout = new GSignal(0);
        mxMAR0 = new GSignal(0, "mxMAR0", true);
        mxMAR1 = new GSignal(0, "mxMAR1", true);
        mxMAR2 = new GSignal(0, "mxMAR2", true);
        mxMDR0 = new GSignal(0, "mxMDR0", true);
        mxMDR1 = new GSignal(0, "mxMDR1", true);
        mxMDR2 = new GSignal(0, "mxMDR2", true);
        REGout1 = new GSignal(0, "regOUT1", true);
        REGout2 = new GSignal(0, "regOUT2", true);
        REGout3 = new GSignal(0, "regOUT3", true);

        REGout.bindOut(1, 3, new GSignal[]{REGout1, REGout2, REGout3});
        TEMPout.bindOut(0, TEMPoutL);
        TEMPout.bindOut(8, TEMPoutH);
        PCout.bindOut(0, PCoutL);
        PCout.bindOut(8, PCoutH);
        
        // Indicators
        Yout = new GMSignal(16, 0, "Y", true);
        Fout = new GMSignal(16, 0, "F", true);
        F0 = new GSignal(0, "F0", true);
        F1 = new GSignal(0, "F1", true);
        F2 = new GSignal(0, "F2", true);
        F3 = new GSignal(0, "F3", true);
        F4 = new GSignal(0, "F4", true);
        F5 = new GSignal(0, "F5", true);
        F6 = new GSignal(0, "F6", true);
        F7 = new GSignal(0, "F7", true);
        F8 = new GSignal(0, "F8", true);
        F9 = new GSignal(0, "F9", true);
        F10 = new GSignal(0, "F10", true);
        F11 = new GSignal(0, "F11", true);
        F12 = new GSignal(0, "F12", true);
        F13 = new GSignal(0, "F13", true);
        F14 = new GSignal(0, "F14", true);
        F15 = new GSignal(0, "F15", true);
        C16 = new GSignal(0, "C16", true);
        X0 = new GSignal(0, "X0", true);
        X15 = new GSignal(0, "X15", true);
        Y15 = new GSignal(0, "Y15", true);
        C16not = new GSignal(0);
        F15not1 = new GSignal(0);
        X15not1 = new GSignal(0);
        Y15not = new GSignal(0);
        X15not2 = new GSignal(0);
        F15not2 = new GSignal(0);
        aluN = new GSignal(0, "aluN", true);
        aluC = new GSignal(0, "aluC", true);
        aluV = new GSignal(0, "aluV", true);
        aluZ = new GSignal(0, "aluZ", true);
        AIOR1out = new GSignal(0);
        AIOR3out = new GSignal(0);
        AIAND1out = new GSignal(0);
        AIAND2out = new GSignal(0);
        AIAND3out = new GSignal(0);
        AIAND4out = new GSignal(0);
        AIAND5out = new GSignal(0);
        AIAND6out = new GSignal(0);
        AIAND7out = new GSignal(0);
        AIAND8out = new GSignal(0);

        Xout.bindOut(0, X0);
        Xout.bindOut(15, X15);
        Yout.bindOut(15, Y15);
        Fout.bindOut(0, 15, new GSignal[]{F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15});

        // IMR
        IMR1 = new GSignal(0, "IMR1", true);
        IMR2 = new GSignal(0, "IMR2", true);
        IMR3 = new GSignal(0, "IMR3", true);
        ldCONTROL = new GSignal(0, "ldCONTROL", true);
        STIMR = new GSignal(0, "STIMR", true);
        stPRINT = new GSignal(0, "stPRINT", true);
        ackPRINT = new GSignal(0, "ackPRINT", true);
        ldPRADROPR = new GSignal(0, "ldPRADROPR", true);
        ackADR = new GSignal(0, "ackADR", true);
        ackOPR = new GSignal(0, "ackOPR", true);
        PRINT = new GSignal(0, "PRINT", true);
        PRADR = new GSignal(0, "PRADR", true);
        PROPR = new GSignal(0, "PROPR", true);
        IMRORout = new GSignal(0);
        IMRAND1out = new GSignal(0);
        IMRAND2out = new GSignal(0);
        IMRAND3out = new GSignal(0);
        IMRAND4out = new GSignal(0);
        IMRAND5out = new GSignal(0);
        IMRAND6out = new GSignal(0);
        IMRAND7out = new GSignal(0);
        IMRAND8out = new GSignal(0);
        REGout1not = new GSignal(0);
        REGout2not = new GSignal(0);
        REGout3not = new GSignal(0);

        // Sync
        SyncCNTin = new GMSignal(3, 5);
        SyncCNTout = new GMSignal(3, 0);
        DRD = new GSignal(0, "DRD", true);
        DWR = new GSignal(0, "DWR", true);
        brqSTART = new GSignal(0, "brqSTART", true);
        brqSTOP = new GSignal(0, "brqSTOP", true);
        run = new GSignal(0, "run", true);
        stopWR = new GSignal(0, "stopWR", true);
        SyncAND1out = new GSignal(0);
        SyncAND3out = new GSignal(0);
        SyncOR1out = new GSignal(0);
        SyncD1Qcompl = new GSignal(0);
        SyncD2Qcompl = new GSignal(0);
        SyncD3Qcompl = new GSignal(0);
        SyncCNTout0 = new GSignal(0);
        SyncCNTout1 = new GSignal(0);
        SyncCNTout2 = new GSignal(0);
        SyncCNTout1not = new GSignal(0);
        SyncCNTout2not = new GSignal(0);
        SyncOR2out = new GSignal(0);
        SyncAND6out = new GSignal(0);
        SyncOR4out = new GSignal(0);

        // ALU
        aluOJO = new GSignal(0, "aluOJO", true);
        aluODO = new GSignal(0, "aluODO", true);
        aluADD = new GSignal(0);
        aluAND = new GSignal(0);
        aluINC = new GSignal(0);
        aluDEC = new GSignal(0);
        aluASR = new GSignal(0);
        transX = new GSignal(0, "transX", true);
        halt = new GSignal(0, "halt", true);
        haltCompl = new GSignal(0, "halt", true);
        ldTEMP = new GSignal(0, "ldTEMP", true);
        ALUANDout = new GSignal(0);

        // PC
        ADRTMPout = new GMSignal(16, 0, "ADRTMP", true);
        DISPH = new GMSignal(8, 0, "DISP15..8", true);
        DISPL = new GMSignal(8, 0, "DISP7..0", true);
        ADRTMPH = new GMSignal(8, 0, "ADRTMP15..8", true);
        ADRTMPL = new GMSignal(8, 0, "ADRTMP7..0", true);
        PCHMPout = new GMSignal(8, 0);
        PCLMPout = new GMSignal(8, 0);
        PCHout = new GMSignal(8, 0);
        PCLout = new GMSignal(8, 0);
        PCin = new GMSignal(16, 0);
        mxPC0 = new GSignal(0, "mxPC0", true);
        mxPC1 = new GSignal(0, "mxPC1", true);
        mxPC2 = new GSignal(0, "mxPC2", true);
        ldPCH = new GSignal(0, "ldPCH", true);
        ldPCL = new GSignal(0, "ldPCL", true);
        ldPC = new GSignal(0, "ldPC", true);
        incPC = new GSignal(0, "incPC", true);
        ldADRTMP = new GSignal(0, "ldADRTMP", true);

        DISPout.bindOut(0, DISPL);
        DISPout.bindOut(8, DISPH);
        ADRTMPout.bindOut(0, ADRTMPL);
        ADRTMPout.bindOut(8, ADRTMPH);
        PCin.bindIn(0, PCLout);
        PCin.bindIn(8, PCHout);

        // XY
        OPR = new GMSignal(16, 0, "OPR", true);
        OPRH = new GMSignal(8, 0, "OPR15..8", true);
        OPRL = new GMSignal(8, 0, "OPR7..0", true);
        XYMP2out = new GMSignal(8, 0);
        XYMP3out = new GMSignal(8, 0);
        YHout = new GMSignal(8, 0, "Y15..8", true);
        YLout = new GMSignal(8, 0, "Y7..0", true);
        IR15_0 = new GMSignal(16, 0, "IR15..0", true);
        ldXH = new GSignal(0, "ldXH", true);
        ldYH = new GSignal(0, "ldYH", true);
        ldXL = new GSignal(0, "ldXL", true);
        ldYL = new GSignal(0, "ldYL", true);
        XYOR1out = new GSignal(0);
        XYOR2out = new GSignal(0);
        XYANDout = new GSignal(0);
        R6not = new GSignal(0);

        IR15_0.bindIn(0, IR7_0);
        IR15_0.bindIn(8, IR15_8);
        OPR.bindOut(0, OPRL);
        OPR.bindOut(8, OPRH);
        Xout.bindIn(0, XLout);
        Xout.bindIn(8, XHout);
        Yout.bindIn(0, YLout);
        Yout.bindIn(8, YHout);

        // DISP
        DISPMP1out = new GMSignal(8, 0);
        DISPMP2out = new GMSignal(8, 0);
        DISPMP3in = new GMSignal(16, 0);
        DISPMP3out = new GMSignal(16, 0);
        DISPMP4out = new GMSignal(16, 0);
        ldTD = new GSignal(0, "ldTD", true);
        IR15 = new GSignal(0, "IR15", true);
        DISPOR1out = new GSignal(0);
        DISPOR2out = new GSignal(0);
        DISPOR3out = new GSignal(0);
        DISPAND1out = new GSignal(0);
        DISPAND2out = new GSignal(0);

        IR15_8.bindOut(7, IR15);
        DISPMP3in.bindIn(0, DISPMP2out);
        DISPMP3in.bindIn(8, DISPMP1out);

        // Registers 1
        one3 = new GMSignal(3, 1);
        five3 = new GMSignal(3, 5);
        six3 = new GMSignal(3, 6);
        seven3 = new GMSignal(3, 7);
        regsel = new GMSignal(3, 0, "regsel", true);
        Reg1MP1out = new GMSignal(3, 0);
        Reg1DCout = new GMSignal(8, 0);
        Reg1CDout = new GMSignal(3, 0);
        Reg1MP2out = new GMSignal(3, 0);
        Reg1MP3out = new GMSignal(3, 0);
        regIN = new GMSignal(16, 0, "regIN", true);
        IR21_19 = new GMSignal(3, 0, "IR21..19", true);
        IR18_16 = new GMSignal(3, 0, "IR18..16", true);
        Reg1DCout0 = new GSignal(0);
        Reg1DCout1 = new GSignal(0);
        Reg1DCout2 = new GSignal(0);
        Reg1DCout3 = new GSignal(0);
        bpdi = new GSignal(0, "bpdi", true);
        bpsi = new GSignal(0, "bpsi", true);
        bxdi = new GSignal(0, "bxdi", true);
        bxsi = new GSignal(0, "bxsi", true);
        R0 = new GSignal(0, "r0", true);
        R1 = new GSignal(0, "r1", true);
        R2 = new GSignal(0, "r2", true);
        R3 = new GSignal(0, "r3", true);
        R4 = new GSignal(0, "r4", true);
        R5 = new GSignal(0, "r5", true);
        R6 = new GSignal(0, "r6", true);
        IR18 = new GSignal(0, "IR18", true);

        IR23_16.bindOut(2, IR18);
        Reg1DCout.bindOut(0, 7, new GSignal[]{Reg1DCout0, Reg1DCout1, Reg1DCout2, Reg1DCout3, bpdi, bpsi, bxdi, bxsi});
        IR18_16.bindIn(0, 2, new GSignal[]{IR16, IR17, IR18});
        IR21_19.bindIn(0, 2, new GSignal[]{IR19, IR20, IR21});

        // Registers 2
        AXout = new GMSignal(16, 0, "AX", false);
        BXout = new GMSignal(16, 0, "BX", false);
        CXout = new GMSignal(16, 0, "CX", false);
        DXout = new GMSignal(16, 0, "DX", false);
        BPout = new GMSignal(16, 0, "BP", false);
        SIout = new GMSignal(16, 0, "SI", false);
        DIout = new GMSignal(16, 0, "DI", false);
        Reg2DCout = new GMSignal(16, 0);
        Reg2MP1out = new GMSignal(16, 0);
        TMPout = new GMSignal(16, 0);
        Reg2ADDout = new GMSignal(16, 0);
        Reg2DCout0 = new GSignal(0);
        Reg2DCout1 = new GSignal(0);
        Reg2DCout2 = new GSignal(0);
        Reg2DCout3 = new GSignal(0);
        Reg2DCout4 = new GSignal(0);
        Reg2DCout5 = new GSignal(0);
        Reg2DCout6 = new GSignal(0);
        Reg2DCout7 = new GSignal(0);
        ldSP = new GSignal(0, "ldSP", true);
        incSP = new GSignal(0, "incSP", true);
        decSP = new GSignal(0, "decSP", true);
        RegORout = new GSignal(0);
        ldTM = new GSignal(0, "ldTM", true);
        R7 = new GSignal(0, "r7", true);
        regsel0 = new GSignal(0);
        regsel1 = new GSignal(0);
        regsel2 = new GSignal(0);
        ldREG = new GSignal(0, "ldREG", true);

        Reg2DCout.bindOut(0, 7, new GSignal[]{Reg2DCout0, Reg2DCout1, Reg2DCout2, Reg2DCout3, Reg2DCout4, Reg2DCout5, Reg2DCout6, Reg2DCout7});
        regsel.bindOut(0, 2, new GSignal[]{regsel0, regsel1, regsel2});

        // PSW 1
        ack = new GSignal(0, "ack", true);
        ldPSWL = new GSignal(0, "ldPSWL", true);
        prL0 = new GSignal(0, "prL0", true);
        prL1 = new GSignal(0, "prL1", true);
        MDR4 = new GSignal(0, "MDR4", true);
        MDR5 = new GSignal(0, "MDR5", true);
        MDR6 = new GSignal(0, "MDR6", true);
        MDR7 = new GSignal(0, "MDR7", true);
        PSWin = new GSignal(0, "PSWin", true);
        PSWL0 = new GSignal(0, "PSWL0", true);
        PSWL1 = new GSignal(0, "PSWL1", true);
        PSWT = new GSignal(0, "PSWT", true);
        PSWI = new GSignal(0, "PSWI", true);
        stPSWT = new GSignal(0, "stPSWT", true);
        clPSWT = new GSignal(0, "clPSWT", true);
        stPSWI = new GSignal(0, "stPSWI", true);
        clPSWI = new GSignal(0, "clPSWI", true);
        PSW1And1Result = new GSignal(0);
        PSW1And2Result = new GSignal(0);
        PSW1And3Result = new GSignal(0);
        PSW1And4Result = new GSignal(0);
        PSW1And5Result = new GSignal(0);
        PSW1And6Result = new GSignal(0);
        PSW1And7Result = new GSignal(0);
        PSW1And8Result = new GSignal(0);
        PSW1And9Result = new GSignal(0);
        PSW1And10Result = new GSignal(0);
        PSW1And11Result = new GSignal(0);
        PSW1And12Result = new GSignal(0);
        clPSWTAndResult = new GSignal(0);
        clPSWIAndResult = new GSignal(0);
        PSW1Or1Result = new GSignal(0);
        PSW1Or2Result = new GSignal(0);
        PSW1Or3Result = new GSignal(0);
        PSW1Or4Result = new GSignal(0);
        PSW1Or5Result = new GSignal(0);
        PSW1Or6Result = new GSignal(0);
        PSW1Or7Result = new GSignal(0);
        PSW1Or8Result = new GSignal(0);
        PSW1Inv1Result = new GSignal(0);
        PSW1Inv2Result = new GSignal(0);
        PSW1Inv3Result = new GSignal(0);
        PSW1Inv4Result = new GSignal(0);
        PSW1Inv5Result = new GSignal(0);
        PSW1Inv6Result = new GSignal(0);

        // PSW 2
        ldFLAGS = new GSignal(0, "ldFLAGS", true);
        MDR0 = new GSignal(0, "MDR0", true);
        MDR1 = new GSignal(0, "MDR1", true);
        MDR2 = new GSignal(0, "MDR2", true);
        MDR3 = new GSignal(0, "MDR3", true);
        PSWN = new GSignal(0, "PSWN", true);
        PSWZ = new GSignal(0, "PSWZ", true);
        PSWC = new GSignal(0, "PSWC", true);
        PSWV = new GSignal(0, "PSWV", true);
        cond = new GSignal(0, "cond", true);
        PSW2And1Result = new GSignal(0);
        PSW2And2Result = new GSignal(0);
        PSW2And3Result = new GSignal(0);
        PSW2And4Result = new GSignal(0);
        PSW2And5Result = new GSignal(0);
        PSW2And6Result = new GSignal(0);
        PSW2And7Result = new GSignal(0);
        PSW2And8Result = new GSignal(0);
        PSW2And9Result = new GSignal(0);
        PSW2And10Result = new GSignal(0);
        PSW2And11Result = new GSignal(0);
        PSW2And12Result = new GSignal(0);
        PSW2And13Result = new GSignal(0);
        PSW2And14Result = new GSignal(0);
        PSW2And15Result = new GSignal(0);
        PSW2And16Result = new GSignal(0);
        PSW2Or1Result = new GSignal(0);
        PSW2Or2Result = new GSignal(0);
        PSW2Or3Result = new GSignal(0);
        PSW2Or4Result = new GSignal(0);
        PSW2Or5Result = new GSignal(0);
        PSW2Or6Result = new GSignal(0);
        PSW2Or7Result = new GSignal(0);
        PSW2Or8Result = new GSignal(0);
        PSW2Inv1Result = new GSignal(0);
        PSW2Inv2Result = new GSignal(0);
        PSW2Inv3Result = new GSignal(0);
        PSW2Inv4Result = new GSignal(0);
        PSW2Inv5Result = new GSignal(0);
        PSW2Inv6Result = new GSignal(0);
        PSW2Inv7Result = new GSignal(0);
        PSW2Inv8Result = new GSignal(0);
        PSW2CondInvResult = new GSignal(0);

        PSWout.bindIn(0, 7, new Signal[]{PSWL0, PSWL1, PSWT, PSWI, PSWN, PSWZ, PSWC, PSWV});

        // MIRQ
        IMRout = new GMSignal(8, 0, "IMR", true);
        PRPERout = new GMSignal(8, 0, "PRPERout", true);
        PRPER1 = new GSignal(0, "PRPER1", true);
        PRPER2 = new GSignal(0, "PRPER2", true);
        PRPER3 = new GSignal(0, "PRPER3", true);
        PRPER = new GSignal(0, "PRPER", true);
        MIA = new GMSignal(2, 0, "A1..0", true);
        MIB = new GMSignal(2, 0, "B1..0", true);
        MILeftResult = new GSignal(0);
        MIMiddleResult  = new GSignal(0);
        MIRightResult  = new GSignal(0);
        MIFarRightResult = new GSignal(0);
        MIOrResult = new GSignal(0);
        MIComparatorG = new GSignal(0);
        MIComparatorL = new GSignal(0);
        MIComparatorE = new GSignal(0);
        MICoderOut = new GMSignal(2, 0);

        IMRout.bindIn(1, IMR1);
        IMRout.bindIn(2, IMR2);
        IMRout.bindIn(3, IMR3);
        PRPERout.bindOut(1, PRPER1);
        PRPERout.bindOut(2, PRPER2);
        PRPERout.bindOut(3, PRPER3);
        MICoderOut.bindOut(0, prL0);
        MICoderOut.bindOut(1, prL1);
        MIA.bindIn(0, prL0);
        MIA.bindIn(1, prL1);
        MIB.bindIn(0, PSWL0);
        MIB.bindIn(1, PSWL1);

        // MIRQACK
        inm = new GSignal(0, "inm", true);
        ackPRINM = new GSignal(0, "ackPRINM", true);
        intr3 = new GSignal(0, "intr3", true);
        ackPER3 = new GSignal(0, "ackPER3", true);
        intr2 = new GSignal(0, "intr2", true);
        ackPER2 = new GSignal(0, "ackPER2", true);
        intr1 = new GSignal(0, "intr1", true);
        ackPER1 = new GSignal(0, "ackPER1", true);
        Finm = new GSignal(0, "Finm", true);
        Fintr3 = new GSignal(0, "Fintr3", true);
        Fintr2 = new GSignal(0, "Fintr2", true);
        Fintr1 = new GSignal(0, "Fintr1", true);
        ldINTEXT = new GSignal(0, "ldINTEXT", true);
        PRINM = new GSignal(0, "PRINM", true);
        MIAAnd1Result = new GSignal(0);
        MIAAnd2Result = new GSignal(0);
        MIAAnd3Result = new GSignal(0);
        MIAAnd4Result = new GSignal(0);

        // Arbitrator
        bSTART = new GSignal(0, "bSTART", true);
        BRQ0 = new GSignal(0, "BRQ0", true);
        BRQ1 = new GSignal(0, "BRQ1", true);
        BRQ2 = new GSignal(0, "BRQ2", true);
        BRQ3 = new GSignal(0, "BRQ3", true);
        BG0 = new GSignal(0, "BG0", true);
        BG1 = new GSignal(0, "BG1", true);
        BG2 = new GSignal(0, "BG2", true);
        BG3 = new GSignal(0, "BG3", true);
        ATriStateLeft1Result = new GSignal(0);
        ATriStateLeft1MResult = new GMSignal(1, 0);
        ATriStateLeft2Result = new GMSignal(1, 0);
        ATriStateRightResult = new GMSignal(1, 0);
        AAndLeftResult = new GSignal(0);
        AOrResult = new GSignal(0);
        AInverterResult = new GSignal(0);
        ACoderOut = new GMSignal(2, 0);
        ADecoderOut = new GMSignal(4, 0);
        ACoderOut0 = new GSignal(0);
        ACoderOut1 = new GSignal(0);
        ACoderW = new GSignal(0);

        ATriStateLeft1MResult.bindOut(0, ATriStateLeft1Result);
        ACoderOut.bindOut(0, ACoderOut0);
        ACoderOut.bindOut(1, ACoderOut1);
        ADecoderOut.bindOut(0, BG0);
        ADecoderOut.bindOut(1, BG1);
        ADecoderOut.bindOut(2, BG2);
        ADecoderOut.bindOut(3, BG3);

        // Interrupts
        ICoderW = new GSignal(0, "CDW", true);
        ICoderOut0 = new GSignal(0);
        ICoderOut1 = new GSignal(0);
        IMMP1S0 = new GSignal(0);
        IMMP1Out0 = new GSignal(0, "MP1out0", true);
        IMMP1Out1 = new GSignal(0, "MP1out1", true);
        IMMP1Out = new GMSignal(2, 0);
        IOrLowerResult = new GSignal(0);
        PREKIDCompl = new GSignal(0, "PREKID", true);
        ackPRADR = new GSignal(0, "ackPRADR", true);
        ackPROPR = new GSignal(0, "ackPROPR", true);
        ackINT = new GSignal(0, "ackINT", true);
        IDecoderOut0 = new GSignal(0);
        IDecoderOut4 = new GSignal(0);
        IDecoderOut = new GMSignal(8, 0);
        IMMP2In = new GMSignal(8, 0);
        IMMP2Out = new GMSignal(8, 0);
        Seven0 = new GMSignal(7, 0);
        Five0 = new GMSignal(5, 0);
        IMMP1in0 = new GMSignal(2, 0);
        IMMP1in1 = new GMSignal(2, 0);
        ADRIVT = new GMSignal(16, 0, "ADRIVT", true);
        IADDin1 = new GMSignal(16, 0);
        IVTPout = new GMSignal(16, 0, "IVTP", true);

        IMMP1in0.bindOut(0, ICoderOut0);
        IMMP1in0.bindOut(1, ICoderOut1);
        IMMP1in1.bindIn(0, prL0);
        IMMP1in1.bindIn(1, prL1);
        IMMP1Out.bindOut(0, IMMP1Out0);
        IMMP1Out.bindOut(1, IMMP1Out1);
        IDecoderOut.bindOut(0, IDecoderOut0);
        IDecoderOut.bindOut(1, ackPRINM);
        IDecoderOut.bindOut(2, ackPRADR);
        IDecoderOut.bindOut(3, ackPROPR);
        IDecoderOut.bindOut(4, IDecoderOut4);
        IDecoderOut.bindOut(5, ackPER1);
        IDecoderOut.bindOut(6, ackPER2);
        IDecoderOut.bindOut(7, ackPER3);
        IMMP2In.bindIn(0, IMMP1Out0);
        IMMP2In.bindIn(1, IMMP1Out1);
        IMMP2In.bindIn(2, IMMP1S0);
        IADDin1.bindIn(0, zero);
        IADDin1.bindIn(1, IMMP2Out);

        // MEM 1
        MABusOut = new GMSignal(16, 0);
        MDBusOut = new GMSignal(8, 0);
        MRDBusOut = new GMSignal(1, 0);
        MWRBusOut = new GMSignal(1, 0);
        MTriState3Out = new GMSignal(8, 0);
        MTriState2Out = new GMSignal(1, 0);
        MTriState1Out = new GMSignal(1, 0);
        DOut = new GMSignal(8, 0);
        DROut = new GMSignal(8, 0);
        MTriState2out = new GSignal(0);
        MTriState1out = new GSignal(0);
        ldCNT = new GSignal(0, "ldCNT", true);
        MOr2Out = new GSignal(0);
        MOr3Out = new GSignal(0);
        FRD = new GSignal(0, "FRD", true);
        FWR = new GSignal(0, "FWR", true);
        FC = new GSignal(0, "FC", true);
        DFC = new GSignal(0, "DFC", true);

        MTriState1Out.bindOut(0, MTriState1out);
        MTriState2Out.bindOut(0, MTriState2out);

        // MEM 2
        CNTIn = new GMSignal(3, 3);
        CNTOut = new GMSignal(3, 0);
        decCNT = new GSignal(0);
        CNTOut0 = new GSignal(0);
        CNTOut1 = new GSignal(0);
        CNTOut2 = new GSignal(0);
        M2Or2Out = new GSignal(0);

        CNTOut.bindOut(0, CNTOut0);
        CNTOut.bindOut(1, CNTOut1);
        CNTOut.bindOut(2, CNTOut2);

        // CU 1
        brOPR = new GSignal(0, "brOPR", true);
        CUldCNT = new GSignal(0);
        CUincCNT = new GSignal(0);
        CUInvOut = new GSignal(0);
        branch = new GSignal(0, "branch", true);
        CUOrOut = new GSignal(0);
        op = new GMSignal(8, 0, "op7..0", true);
        br = new GMSignal(8, 0, "br7..0", true);
        CUMPOut = new GMSignal(8, 0);
        CUCNTOut = new GMSignal(8, 0, "CUCNT", true);

        // CU 2
        createTSignals();
        CUDCOut = new GBigMSignal(256, 0, "CUDC", true);
        CUDCOut169_0 = new GBigMSignal(170, 0, "CUDC169..0", true);

        CUDCOut.bindOut(0, CUDCOut169_0);
        CUDCOut169_0.bindOut(0, 169, new GSignal[]{T00, T01, T02, T03, T04, T05, T06, T07, T08, T09, T0A, T0B, T0C, T0D, T0E, T0F, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T1A, T1B, T1C, T1D, T1E, T1F, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T2A, T2B, T2C, T2D, T2E, T2F, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T3A, T3B, T3C, T3D, T3E, T3F, T40, T41, T42, T43, T44, T45, T46, T47, T48, T49, T4A, T4B, T4C, T4D, T4E, T4F, T50, T51, T52, T53, T54, T55, T56, T57, T58, T59, T5A, T5B, T5C, T5D, T5E, T5F, T60, T61, T62, T63, T64, T65, T66, T67, T68, T69, T6A, T6B, T6C, T6D, T6E, T6F, T70, T71, T72, T73, T74, T75, T76, T77, T78, T79, T7A, T7B, T7C, T7D, T7E, T7F, T80, T81, T82, T83, T84, T85, T86, T87, T88, T89, T8A, T8B, T8C, T8D, T8E, T8F, T90, T91, T92, T93, T94, T95, T96, T97, T98, T99, T9A, T9B, T9C, T9D, T9E, T9F, TA0, TA1, TA2, TA3, TA4, TA5, TA6, TA7, TA8, TA9});

        // CUSOP
        incMAR_ = new Signal(0);
        incSP_ = new Signal(0);
        run_ = new Signal(0);

        // CUSCU
        brOPR1 = new GSignal(0,"brOPR1", true);
        brOPR2 = new GSignal(0,"brOPR2", true);
        bruncnd = new GSignal(0,"bruncnd", true);
        brgrADROPR = new GSignal(0,"brgrADROPR", true);
        brL1 = new GSignal(0,"brL1", true);
        brL2 = new GSignal(0,"brL2", true);
        brL3 = new GSignal(0,"brL3", true);
        brnotPREKID = new GSignal(0,"brnotPREKID", true);
        brnotCOND = new GSignal(0,"brnotCOND", true);
        condCompl = new GSignal(0,"cond", true);
        brnotreg = new GSignal(0,"brnotreg", true);
        regCompl = new GSignal(0,"regCompl", true);
        brnotimmreg = new GSignal(0,"brnotimmreg", true);
        immregCompl = new GSignal(0,"immregCompl", true);
        brnotmemind = new GSignal(0,"brnotmemind", true);
        memindCompl = new GSignal(0,"memindCompl", true);
        brmemind = new GSignal(0,"brmemind", true);
        brnotregip = new GSignal(0,"brnotregip", true);
        regipCompl = new GSignal(0,"regipCompl", true);
        brbxsi = new GSignal(0,"brbxsi", true);
        brbxdi = new GSignal(0,"brbxdi", true);
        brbpsi = new GSignal(0,"brbpsi", true);
        brbpdi = new GSignal(0,"brbpdi", true);
        brNAD2 = new GSignal(0,"brNAD2", true);
        brnotNAD = new GSignal(0,"brnotNAD", true);
        NADCompl = new GSignal(0,"NADCompl", true);
        createVAL();
        SCUAND1Out = new GSignal(0, "A1", true);
        SCUAND2Out = new GSignal(0, "A2", true);
        SCUAND3Out = new GSignal(0, "A3", true);
        SCUAND4Out = new GSignal(0, "A4", true);
        SCUAND5Out = new GSignal(0, "A5", true);
        SCUAND6Out = new GSignal(0, "A6", true);
        SCUAND7Out = new GSignal(0, "A7", true);
        SCUAND8Out = new GSignal(0, "A8", true);
        SCUAND9Out = new GSignal(0, "A9", true);
        SCUAND10Out = new GSignal(0, "A10", true);
        SCUAND11Out = new GSignal(0, "A11", true);
        SCUAND12Out = new GSignal(0, "A12", true);
        SCUAND13Out = new GSignal(0, "A13", true);
        SCUAND14Out = new GSignal(0, "A14", true);
        SCUAND15Out = new GSignal(0, "A15", true);
        SCUAND16Out = new GSignal(0, "A16", true);
        SCUAND17Out = new GSignal(0, "A17", true);

        //CUOPR
        createVSigs();
        CUOPRCoderOut = new GMSignal(5, 0);
        CUOPRCoderOut0 = new GSignal(0);
        CUOPRCoderOut1 = new GSignal(0);
        CUOPRCoderOut2 = new GSignal(0);
        CUOPRCoderOut3 = new GSignal(0);
        CUOPRCoderOut4 = new GSignal(0);
        CUOPRAND1out = new GSignal(0, "OJO3", true);
        CUOPRAND2out = new GSignal(0, "PUSH3", true);
        CUOPRAND3out = new GSignal(0, "JMPIND3", true);
        CUOPRAND4out = new GSignal(0, "MOVS3", true);
        CUOPRAND5out = new GSignal(0, "ODO3", true);

        CUOPRCoderOut.bindOut(0, CUOPRCoderOut0);
        CUOPRCoderOut.bindOut(1, CUOPRCoderOut1);
        CUOPRCoderOut.bindOut(2, CUOPRCoderOut2);
        CUOPRCoderOut.bindOut(3, CUOPRCoderOut3);
        CUOPRCoderOut.bindOut(4, CUOPRCoderOut4);
        
        // CUBRANCH
        CUBRANCHCoderOut = new GMSignal(5, 0);
        CUBRANCHCoderOut0 = new GSignal(0);
        CUBRANCHCoderOut1 = new GSignal(0);
        CUBRANCHCoderOut2 = new GSignal(0);
        CUBRANCHCoderOut3 = new GSignal(0);
        CUBRANCHCoderOut4 = new GSignal(0);

        CUBRANCHCoderOut.bindOut(0, CUBRANCHCoderOut0);
        CUBRANCHCoderOut.bindOut(1, CUBRANCHCoderOut1);
        CUBRANCHCoderOut.bindOut(2, CUBRANCHCoderOut2);
        CUBRANCHCoderOut.bindOut(3, CUBRANCHCoderOut3);
        CUBRANCHCoderOut.bindOut(4, CUBRANCHCoderOut4);

        addToSignalRegistry();
    }

    private static void addToSignalRegistry(){
        ldIR1.addToSignalRegistry();
        ldIR2.addToSignalRegistry();
        ldIR3.addToSignalRegistry();
        ldIR4.addToSignalRegistry();
        regdir.addToSignalRegistry();
        regind.addToSignalRegistry();
        regindpom.addToSignalRegistry();
        memdir.addToSignalRegistry();
        memind.addToSignalRegistry();
        rel.addToSignalRegistry();
        imm.addToSignalRegistry();
        mem.addToSignalRegistry();
        immreg.addToSignalRegistry();
        regip.addToSignalRegistry();
        L1.addToSignalRegistry();
        L2.addToSignalRegistry();
        L3.addToSignalRegistry();
        NOP.addToSignalRegistry();
        RTS.addToSignalRegistry();
        RTI.addToSignalRegistry();
        INTE.addToSignalRegistry();
        INTD.addToSignalRegistry();
        TRPE.addToSignalRegistry();
        TRPD.addToSignalRegistry();
        HALT.addToSignalRegistry();
        JMP.addToSignalRegistry();
        INT.addToSignalRegistry();
        JSR.addToSignalRegistry();
        BNZ.addToSignalRegistry();
        ASR.addToSignalRegistry();
        PUSH.addToSignalRegistry();
        POP.addToSignalRegistry();
        INC.addToSignalRegistry();
        DEC.addToSignalRegistry();
        JMPIND.addToSignalRegistry();
        MOVS.addToSignalRegistry();
        MOVD.addToSignalRegistry();
        ADD.addToSignalRegistry();
        AND.addToSignalRegistry();
        grADR.addToSignalRegistry();
        grOPR.addToSignalRegistry();
        CTRL.addToSignalRegistry();
        OJO.addToSignalRegistry();
        ODO.addToSignalRegistry();
        NAD.addToSignalRegistry();
        NAD2.addToSignalRegistry();
        OJO2.addToSignalRegistry();
        ODO2.addToSignalRegistry();
        MOVS2.addToSignalRegistry();
        PUSH2.addToSignalRegistry();
        JMPIND2.addToSignalRegistry();
        grADROPR.addToSignalRegistry();
        busHOLD.addToSignalRegistry();
        write.addToSignalRegistry();
        read.addToSignalRegistry();
        rd.addToSignalRegistry();
        wr.addToSignalRegistry();
        ldMAR.addToSignalRegistry();
        incMAR.addToSignalRegistry();
        stopRD.addToSignalRegistry();
        ldMDR.addToSignalRegistry();
        mxMAR0.addToSignalRegistry();
        mxMAR1.addToSignalRegistry();
        mxMAR2.addToSignalRegistry();
        mxMDR0.addToSignalRegistry();
        mxMDR1.addToSignalRegistry();
        mxMDR2.addToSignalRegistry();
        C16.addToSignalRegistry();
        aluN.addToSignalRegistry();
        aluC.addToSignalRegistry();
        aluV.addToSignalRegistry();
        aluZ.addToSignalRegistry();
        IMR1.addToSignalRegistry();
        IMR2.addToSignalRegistry();
        IMR3.addToSignalRegistry();
        ldCONTROL.addToSignalRegistry();
        STIMR.addToSignalRegistry();
        stPRINT.addToSignalRegistry();
        ackPRINT.addToSignalRegistry();
        ldPRADROPR.addToSignalRegistry();
        ackADR.addToSignalRegistry();
        ackOPR.addToSignalRegistry();
        PRINT.addToSignalRegistry();
        PRADR.addToSignalRegistry();
        PROPR.addToSignalRegistry();
        DRD.addToSignalRegistry();
        DWR.addToSignalRegistry();
        brqSTART.addToSignalRegistry();
        brqSTOP.addToSignalRegistry();
        run.addToSignalRegistry();
        stopWR.addToSignalRegistry();
        aluOJO.addToSignalRegistry();
        aluODO.addToSignalRegistry();
        transX.addToSignalRegistry();
        halt.addToSignalRegistry();
        ldTEMP.addToSignalRegistry();
        mxPC0.addToSignalRegistry();
        mxPC1.addToSignalRegistry();
        mxPC2.addToSignalRegistry();
        ldPCH.addToSignalRegistry();
        ldPCL.addToSignalRegistry();
        ldPC.addToSignalRegistry();
        incPC.addToSignalRegistry();
        ldADRTMP.addToSignalRegistry();
        ldXH.addToSignalRegistry();
        ldYH.addToSignalRegistry();
        ldXL.addToSignalRegistry();
        ldYL.addToSignalRegistry();
        ldTD.addToSignalRegistry();
        bpdi.addToSignalRegistry();
        bpsi.addToSignalRegistry();
        bxdi.addToSignalRegistry();
        bxsi.addToSignalRegistry();
        R0.addToSignalRegistry();
        R1.addToSignalRegistry();
        R2.addToSignalRegistry();
        R3.addToSignalRegistry();
        R4.addToSignalRegistry();
        R5.addToSignalRegistry();
        R6.addToSignalRegistry();
        R7.addToSignalRegistry();
        ldSP.addToSignalRegistry();
        incSP.addToSignalRegistry();
        decSP.addToSignalRegistry();
        ldTM.addToSignalRegistry();
        ldREG.addToSignalRegistry();
        ack.addToSignalRegistry();
        ldPSWL.addToSignalRegistry();
        prL0.addToSignalRegistry();
        prL1.addToSignalRegistry();
        PSWin.addToSignalRegistry();
        PSWL0.addToSignalRegistry();
        PSWL1.addToSignalRegistry();
        PSWT.addToSignalRegistry();
        PSWI.addToSignalRegistry();
        stPSWT.addToSignalRegistry();
        clPSWT.addToSignalRegistry();
        stPSWI.addToSignalRegistry();
        clPSWI.addToSignalRegistry();
        ldFLAGS.addToSignalRegistry();
        PSWN.addToSignalRegistry();
        PSWZ.addToSignalRegistry();
        PSWC.addToSignalRegistry();
        PSWV.addToSignalRegistry();
        cond.addToSignalRegistry();
        PRPER1.addToSignalRegistry();
        PRPER2.addToSignalRegistry();
        PRPER3.addToSignalRegistry();
        PRPER.addToSignalRegistry();
        inm.addToSignalRegistry();
        ackPRINM.addToSignalRegistry();
        intr3.addToSignalRegistry();
        ackPER3.addToSignalRegistry();
        intr2.addToSignalRegistry();
        ackPER2.addToSignalRegistry();
        intr1.addToSignalRegistry();
        ackPER1.addToSignalRegistry();
        Finm.addToSignalRegistry();
        Fintr3.addToSignalRegistry();
        Fintr2.addToSignalRegistry();
        Fintr1.addToSignalRegistry();
        ldINTEXT.addToSignalRegistry();
        PRINM.addToSignalRegistry();
        bSTART.addToSignalRegistry();
        BRQ0.addToSignalRegistry();
        BRQ1.addToSignalRegistry();
        BRQ2.addToSignalRegistry();
        BRQ3.addToSignalRegistry();
        BG0.addToSignalRegistry();
        BG1.addToSignalRegistry();
        BG2.addToSignalRegistry();
        BG3.addToSignalRegistry();
        PREKIDCompl.addToSignalRegistry();
        ackPRADR.addToSignalRegistry();
        ackPROPR.addToSignalRegistry();
        ackINT.addToSignalRegistry();
        ldCNT.addToSignalRegistry();
        FRD.addToSignalRegistry();
        FWR.addToSignalRegistry();
        FC.addToSignalRegistry();
        DFC.addToSignalRegistry();
    }

    private static void tabCPU() {
        // Create stuff
        CPU = new ClickableElement(0, "CPU ", 250, 330);
        OperUnit = new ClickableElement(0, "Operation Unit ", 230, 250);
        ContrUnit = new ClickableElement(22, "Control Unit", 230, 30);
        BlockMemory = new ClickableElement(20, "Memory  ", 200, 200);
        BlockRegs = new ClickableElement(1, "Registers", 100, 100);
        BlockInterface = new ClickableElement(17, " Interface", 100, 100);
        BlockOper = new ClickableElement(11, "Operations", 100, 100);
        BlockInterrupt = new ClickableElement(13, " Interrupts", 100, 100);
        
        // Logics
        CPU.setBottom(true);
        OperUnit.setBottom(true);
        RDBUS.setComplement();
        WRBUS.setComplement();
        BUSYBUS.setComplement();

        // Coordinates
        CPU.setCoords(50, 140);
        OperUnit.setCoords(60, 150);
        ContrUnit.setCoords(60, 410);
        BlockMemory.setCoords(500, 140);
        BlockRegs.setCoords(70, 160);
        BlockInterface.setCoords(180, 160);
        BlockOper.setCoords(70, 270);
        BlockInterrupt.setCoords(180, 270);
    }

    private static void tabPC(){
        // Create stuff
        PC = new GCounter(16, 0x100, PCin, "PC");
        PCH = new GRegister(8, 0, PCHMPout, "PCH");
        PCL = new GRegister(8, 0, PCLMPout, "PCL");
        ADRTMP = new GRegister(16, 0, PCout, "ADRTMP");
        PCHMP = new GMMultiplexer(8, 5);
        PCLMP = new GMMultiplexer(8, 5);

        // Logics
        PCHMP.addIn(one8).addIn(MDRout).addIn(IR23_16).addIn(ADRTMPH).addIn(DISPH).addIn(XHout);
        PCHMP.addControl(mxPC0).addControl(mxPC1).addControl(mxPC2).setResult(PCHMPout);
        PCLMP.addIn(zero8).addIn(MDRout).addIn(IR15_8).addIn(ADRTMPL).addIn(DISPL).addIn(XLout);
        PCLMP.addControl(mxPC0).addControl(mxPC1).addControl(mxPC2).setResult(PCLMPout);
        PCH.setLoadSignal(ldPCH).setResult(PCHout);
        PCL.setLoadSignal(ldPCL).setResult(PCLout);
        PC.setIncSignal(incPC).setLoadSignal(ldPC).setResult(PCout);
        ADRTMP.setLoadSignal(ldADRTMP).setResult(ADRTMPout);

        // Coordinates
        PCHMP.rotate().setCoords(90, 60);
        PCH.setCoords(100, 190);
        PCLMP.rotate().setCoords(390, 60);
        PCL.setCoords(400, 190);
        PC.setCoords(250, 310);
        ADRTMP.setCoords(250, 400);
    }

    private static void tabIF() {
        // Create stuff
        IR_1 = new GRegister(8, 0x0, MDRout, "IR1");
        IR_2 = new GRegister(8, 0x0, MDRout, "IR2");
        IR_3 = new GRegister(8, 0x0, MDRout, "IR3");
        IR_4 = new GRegister(8, 0x0, MDRout, "IR4");
        IFDC1 = new GDecoder(2);
        IFDC2 = new GDecoder(2);
        IFInv1 = new GInverter(IR31, IR31not1);
        IFInv2 = new GInverter(IR31, IR31not2);
        IFInv3 = new GInverter(IR29, IR29not1);
        IFAND1 = new GAND();
        IFAND2 = new GAND();
        IFOR1 = new GOR();
        IFOR2 = new GOR();
        IFOR3 = new GOR();
        IFOR4 = new GOR();
        IFOR5 = new GOR();
        IFOR6 = new GOR();
        
        // Logics
        IR_1.setLoadSignal(ldIR1).setResult(IR31_24);
        IR_2.setLoadSignal(ldIR2).setResult(IR23_16);
        IR_3.setLoadSignal(ldIR3).setResult(IR15_8);
        IR_4.setLoadSignal(ldIR4).setResult(IR7_0);
        IFDC1.setEnableBit(IR31).add(IR22).add(IR23).setResult(IFDC1out);
        IFDC2.setEnableBit(rest).add(IR16).add(IR17).setResult(IFDC2out);
        IFAND1.add(IR31not1).add(IR30).add(IR29).setResult(L2in3);
        IFAND2.add(IR31not2).add(IR30).add(IR29not1).setResult(L3in1);
        IFOR1.add(IR31).add(IR30).not().setResult(L1);
        IFOR2.add(regdir).add(regind).add(L2in3).setResult(L2);
        IFOR3.add(L3in1).add(rel).add(regindpom).setResult(L3);
        IFOR4.add(memdir).add(memind).setResult(mem);
        IFOR5.add(regdir).add(imm).setResult(immreg);
        IFOR6.add(regind).add(regindpom).setResult(regip);

        // Coordinates
        IR_1.setCoords(50, 50);
        IR_2.setCoords(250, 50);
        IR_3.setCoords(450, 50);
        IR_4.setCoords(650, 50);
        IFDC1.setCoords(50, 180);
        IFDC2.setCoords(350, 180);
        IFOR1.setCoords(100, 390);
        IFAND1.setCoords(300, 360);
        IFInv1.setCoords(IFAND1.getUpperInv3Position().getX1(), IFAND1.getUpperInv3Position().getY1());
        IFAND2.setCoords(300, 410);
        IFInv2.setCoords(IFAND2.getUpperInv3Position().getX1(), IFAND2.getUpperInv3Position().getY1());
        IFInv3.setCoords(IFAND2.getLowerInv3Position().getX1(), IFAND2.getLowerInv3Position().getY1());
        IFOR2.setCoords(400, 344);
        IFOR3.setCoords(400, 425);
        IFOR4.setCoords(600, 344);
        IFOR5.setCoords(600, 382);
        IFOR6.setCoords(600, 425);
    }

    private static void tabID() {
        // Create stuff
        IDDC1 = new GDecoder(3);
        IDDC2 = new GDecoder(2);
        IDDC3 = new GDecoder(3);
        IDDC4 = new GDecoder(3);
        IDAND1 = new GAND();
        IDAND2 = new GAND();
        IDAND3 = new GAND();
        IDAND4 = new GAND();
        IDAND5 = new GAND();
        IDAND6 = new GAND();
        IDAND7 = new GAND();
        IDAND8 = new GAND();
        IDAND9 = new GAND();
        IDAND10 = new GAND();
        IDAND11 = new GAND();
        IDAND12 = new GAND();
        IDAND13 = new GAND();
        IDAND14 = new GAND();
        IDAND15 = new GAND();
        IDOR1 = new GOR();
        IDOR2 = new GOR();
        IDOR3 = new GOR();
        IDOR4 = new GOR();
        IDOR5 = new GOR();
        IDOR6 = new GOR();
        IDOR7 = new GOR();
        IDOR8 = new GOR();
        IDOR9 = new GOR();
        IDOR10 = new GOR();
        IDOR11 = new GOR();
        IDOR12 = new GOR();
        IDOR13 = new GOR();
        IDInv1 = new GInverter(IR31, IR31not3);
        IDInv2 = new GInverter(IDAND6out, IDAND6outnot);
        IDInv3 = new GInverter(IDOR3out, IDOR3outnot);
        IDInv4 = new GInverter(L1, IFL1not1);
        IDInv5 = new GInverter(IR29, IR29not2);
        IDInv6 = new GInverter(IR29, IR29not3);
        IDInv7 = new GInverter(IR31, IR31not4);
        IDInv8 = new GInverter(IR31, IR31not5);
        IDInv9 = new GInverter(L1, IFL1not2);

        // Logics
        IDOR1.add(IR31).add(IR30).not().setResult(IDOR1out);
        IDDC1.setEnableBit(IDOR1out).add(IR24).add(IR25).add(IR26).setResult(IDDC1out);
        IDAND1.add(IR31not3).add(IR30).setResult(IDAND1out);
        IDDC2.setEnableBit(IDAND1out).add(IR24).add(IR25).setResult(IDDC2out);
        IDOR3.add(IR30).add(IR29).add(IR28).add(IR27).add(IR26).add(IR25).add(IR24).setResult(IDOR3out);
        IDOR4.add(IR19).add(IR20).add(IR21).setResult(IDOR4out);
        IDOR5.add(IDOR3out).add(L1).add(IDOR4out).not().setResult(ASR);
        IDAND9.add(IDOR4out).add(IFL1not1).add(IDOR3outnot).setResult(IDAND9out);
        IDAND6.add(IR30).add(IR29).add(IR28).add(IR27).add(IR26).add(IR25).add(IR24).setResult(IDAND6out);
        IDAND7.add(IR31).add(IDAND6out).setResult(IDAND7out);
        IDDC3.setEnableBit(IDAND7out).add(IR19).add(IR20).add(IR21).setResult(IDDC3out);
        IDAND8.add(IR31).add(IDOR3out).add(IDAND6outnot).setResult(IDAND8out);
        IDDC4.setEnableBit(IDAND8out).add(IR24).add(IR25).add(IR26).setResult(IDDC4out);
        IDAND2.add(IR29not2).add(IDDC2out0).setResult(JMP);
        IDAND3.add(IR29).add(IDDC2out0).setResult(INT);
        IDAND4.add(IDDC2out1).add(IR29not3).setResult(JSR);
        IDAND5.add(IDDC2out1).add(IR29).setResult(BNZ);
        IDOR2.add(IDDC2out2).add(IDDC2out3).setResult(IDOR2out);
        IDOR6.add(IDDC3out5).add(IDDC3out6).add(IDDC3out7).setResult(IDOR6out);
        IDOR7.add(IDDC4out5).add(IDDC4out6).add(IDDC4out7).setResult(IDOR7out);
        IDOR8.add(IR27).add(IR28).add(IR29).setResult(IDOR8out);
        IDAND10.add(IR31not4).add(IDOR8out).setResult(IDAND10out);
        IDOR9.add(IR26).add(IR27).add(IR28).setResult(IDOR9out);
        IDAND11.add(IR31not5).add(IFL1not2).add(IDOR9out).setResult(IDAND11out);
        IDOR10.add(IR27).add(IR28).add(IR29).add(IR30).setResult(IDOR10out);
        IDAND12.add(IR27).add(IR28).add(IR29).add(IR30).not().setResult(IDAND12out);
        IDAND13.add(IR31).add(IDOR10out).add(IDAND12out).setResult(IDAND13out);
        IDOR11.add(IDOR2out).add(IDAND9out).add(IDOR6out).add(IDOR7out).add(IDAND10out).add(IDAND11out).add(IDAND13out).setResult(grOPR);
        IDOR12.add(ASR).add(POP).add(INC).add(DEC).add(JMPIND).add(MOVD).setResult(IDOR12out);
        IDAND14.add(imm).add(IDOR12out).setResult(IDAND14out);
        IDAND15.add(JMPIND).add(regdir).setResult(IDAND15out);
        IDOR13.add(IDAND14out).add(IDAND15out).setResult(grADR);

        // Coordinates
        IDDC1.setCoords(60, 60);
        IDDC2.setCoords(260, 60);
        IDDC3.setCoords(60, 330);
        IDDC4.setCoords(260, 330);
        IDOR1.setCoords(60, 20);
        IDAND1.setCoords(260, 20);
        IDInv1.setCoords(IDAND1.getUpperInv2Position().getX1(), IDAND1.getUpperInv2Position().getY1());
        IDAND2.setCoords(460, 29);
        IDAND3.setCoords(460, 61);
        IDAND4.setCoords(460, 104);
        IDAND5.setCoords(460, 136);
        IDInv5.setCoords(IDAND2.getUpperInv2Position().getX1(), IDAND2.getUpperInv2Position().getY1());
        IDInv6.setCoords(IDAND4.getLowerInv2Position().getX1(), IDAND4.getLowerInv2Position().getY1());
        IDOR2.setCoords(385, 143);
        IDOR3.setCoords(60, 250);
        IDAND6.setCoords(140, 250);
        IDAND7.setCoords(205, 258);
        IDAND8.setCoords(285, 260);
        IDInv2.setCoords(IDAND8.getMiddleInv3Position().getX1(), IDAND8.getMiddleInv3Position().getY1());
        IDOR4.setCoords(330, 229);
        IDOR5.setCoords(400, 213);
        IDAND9.setCoords(400, 255);
        IDInv3.setCoords(IDAND9.getUpperInv3Position().getX1(), IDAND9.getUpperInv3Position().getY1());
        IDInv4.setCoords(IDAND9.getMiddleInv3Position().getX1(), IDAND9.getMiddleInv3Position().getY1());
        IDOR6.setCoords(180, 422);
        IDOR7.setCoords(380, 422);
        IDOR12.setCoords(600, 68);
        IDAND14.setCoords(660, 62);
        IDAND15.setCoords(660, 92);
        IDOR13.setCoords(730, 77);
        IDOR8.setCoords(590, 218);
        IDOR9.setCoords(590, 315);
        IDAND12.setCoords(500, 380);
        IDOR10.setCoords(590, 380);
        IDAND10.setCoords(650, 210);
        IDAND11.setCoords(650, 300);
        IDAND13.setCoords(650, 380);
        IDInv7.setCoords(IDAND10.getUpperInv2Position().getX1(), IDAND10.getUpperInv2Position().getY1());
        IDInv8.setCoords(IDAND11.getUpperInv3Position().getX1(), IDAND11.getUpperInv3Position().getY1());
        IDInv9.setCoords(IDAND11.getMiddleInv3Position().getX1(), IDAND11.getMiddleInv3Position().getY1());
        IDOR11.setCoords(730, 300);
    }

    private static void tabAux(){
        // Create stuff
        AuxAND1 = new GAND();
        AuxAND2 = new GAND();
        AuxAND3 = new GAND();
        AuxAND4 = new GAND();
        AuxAND5 = new GAND();
        AuxOR1 = new GOR();
        AuxOR2 = new GOR();
        AuxOR3 = new GOR();
        AuxOR4 = new GOR();
        AuxOR5 = new GOR();
        AuxOR6 = new GOR();

        // Logics
        AuxOR1.add(INTE).add(INTD).add(TRPE).add(TRPD).add(HALT).setResult(CTRL);
        AuxOR2.add(ADD).add(AND).setResult(ODO);
        AuxOR3.add(INC).add(DEC).add(ASR).setResult(OJO);
        AuxOR4.add(OJO).add(PUSH).add(JMPIND).add(MOVS).add(ODO).setResult(NAD);
        AuxOR5.add(POP).add(MOVD).setResult(NAD2);
        AuxAND1.add(NAD).add(OJO).setResult(OJO2);
        AuxAND2.add(NAD).add(ODO).setResult(ODO2);
        AuxAND3.add(NAD).add(MOVS).setResult(MOVS2);
        AuxAND4.add(NAD).add(PUSH).setResult(PUSH2);
        AuxAND5.add(NAD).add(JMPIND).setResult(JMPIND2);
        AuxOR6.add(grADR).add(grOPR).setResult(grADROPR);

        // Coordinates
        AuxOR1.setCoords(70, 50);
        AuxOR2.setCoords(70, 120);
        AuxOR3.setCoords(70, 180);
        AuxOR4.setCoords(70, 250);
        AuxOR5.setCoords(70, 320);
        AuxOR6.setCoords(390, 180);
        AuxAND1.setCoords(230, 60);
        AuxAND2.setCoords(230, 120);
        AuxAND3.setCoords(230, 180);
        AuxAND4.setCoords(230, 240);
        AuxAND5.setCoords(230, 300);
    }

    private static void tabRegisters1(){
        // Create stuff
        Reg1MP1 = new GMMultiplexer(3, 4);
        Reg1MP2 = new GMMultiplexer(3, 2);
        Reg1MP3 = new GMMultiplexer(3, 2);
        Reg1MP4 = new GMMultiplexer(3, 2);
        Reg1MP5 = new GMMultiplexer(16, 4);
        Reg1DC = new GDecoder(3);
        Reg1CD = new GEncoder(8);

        // Logics
        Reg1MP1.setName("MX1");
        Reg1MP3.setName("MX2");
        Reg1MP2.setName("MX6");
        Reg1MP4.setName("MX3");
        Reg1MP5.setName("MX4");
        Reg1MP1.addIn(one3).addIn(five3).addIn(six3).addIn(seven3);
        Reg1MP1.addControl(R0).addControl(R1).setResult(Reg1MP1out);
        Reg1DC.add(IR16).add(IR17).add(IR18).setResult(Reg1DCout);
        Reg1CD.add(zero).add(Reg1DCout0).add(zero).add(zero).add(zero).add(Reg1DCout1).add(Reg1DCout2).add(Reg1DCout3);
        Reg1CD.setResult(Reg1CDout);
        Reg1MP2.addIn(IR18_16).addIn(IR21_19).addControl(R6).setResult(Reg1MP2out);
        Reg1MP3.addIn(Reg1MP1out).addIn(Reg1CDout).addControl(R2).setResult(Reg1MP3out);
        Reg1MP4.addIn(Reg1MP2out).addIn(Reg1MP3out).addControl(R3).setResult(regsel);
        Reg1MP5.addIn(Fout).addIn(TEMPout).addIn(Xout).addIn(Yout).addControl(R4).addControl(R5).setResult(regIN);

        // Coordinates
        Reg1MP1.setCoords(60, 60);
        Reg1DC.setCoords(60, 300);
        Reg1CD.setCoords(260, 200);
        Reg1MP2.setCoords(450, 30);
        Reg1MP3.setCoords(450, 220);
        Reg1MP4.setCoords(630, 75);
        Reg1MP5.setCoords(630, 300);
    }

    private static void tabRegisters2(){
        // Create stuff
        Reg2DC = new GDecoder(3, regsel);
        Reg2MP1 = new GMMultiplexer(16, 8);
        Reg2MP2 = new GMMultiplexer(16, 2);
        Reg2ADD = new GAdder(16, TMPout, Reg2MP1out);
        RegOR = new GOR();
        RegTMP = new GRegister(16, 0, Reg2MP1out, "TMP");
        AX = new GRegister(16, 0x0, regIN, "AX");
        BX = new GRegister(16, 0x0, regIN, "BX");
        CX = new GRegister(16, 0x0, regIN, "CX");
        DX = new GRegister(16, 0x0, regIN, "DX");
        SP = new GCounter(16, 0x400, regIN, "SP");
        BP = new GRegister(16, 0x0, regIN, "BP");
        SI = new GRegister(16, 0x0, regIN, "SI");
        DI = new GRegister(16, 0x0, regIN, "DI");

        // Logics
        Reg2MP1.setName("MX5");
        Reg2MP2.setName("MX7");
        Reg2DC.setEnableBit(ldREG).setResult(Reg2DCout);
        AX.setLoadSignal(Reg2DCout0).setResult(AXout);
        BX.setLoadSignal(Reg2DCout1).setResult(BXout);
        CX.setLoadSignal(Reg2DCout2).setResult(CXout);
        DX.setLoadSignal(Reg2DCout3).setResult(DXout);
        RegOR.add(Reg2DCout4).add(ldSP).setResult(RegORout);
        SP.setIncSignal(incSP).setDecSignal(decSP).setLoadSignal(RegORout).setResult(SPout);
        BP.setLoadSignal(Reg2DCout5).setResult(BPout);
        SI.setLoadSignal(Reg2DCout6).setResult(SIout);
        DI.setLoadSignal(Reg2DCout7).setResult(DIout);
        Reg2MP1.addIn(AXout).addIn(BXout).addIn(CXout).addIn(DXout).addIn(SPout).addIn(BPout).addIn(SIout).addIn(DIout);
        Reg2MP1.addControl(regsel0).addControl(regsel1).addControl(regsel2).setResult(Reg2MP1out);
        RegTMP.setLoadSignal(ldTM).setResult(TMPout);
        Reg2ADD.setResult(Reg2ADDout);
        Reg2MP2.addIn(Reg2MP1out).addIn(Reg2ADDout).addControl(R7).setResult(REGout);

        // Coordinates
        Reg2DC.setCoords(40, 200);
        BX.setCoords(200, 50);
        AX.setCoords(400, 50);
        DX.setCoords(200, 170);
        CX.setCoords(400, 170);
        BP.setCoords(200, 290);
        RegOR.setCoords(350, 308);
        SP.setCoords(400, 290);
        DI.setCoords(200, 410);
        SI.setCoords(400, 410);
        Reg2MP1.setCoords(600, 20);
        RegTMP.setCoords(600, 200);
        Reg2ADD.setCoords(640, 280);
        Reg2MP2.rotate().setCoords(630, 370);
    }

    private static void tabXY(){
        // Create stuff
        XYMP1 = new GMMultiplexer(16, 2);
        XYMP2 = new GMMultiplexer(8, 2);
        XYMP3 = new GMMultiplexer(8, 2);
        XH = new GRegister(8, 0x0, XYMP2out, "XH");
        XL = new GRegister(8, 0x0, XYMP3out, "XL");
        YH = new GRegister(8, 0x0, XYMP2out, "YH");
        YL = new GRegister(8, 0x0, XYMP3out, "YL");
        XYOR1 = new GOR();
        XYOR2 = new GOR();
        XYAND = new GAND();
        XYInv = new GInverter(R6, R6not);

        // Logics
        XYAND.add(imm).add(R6not).setResult(XYANDout);
        XYOR1.add(immreg).add(R6).setResult(XYOR1out);
        XYOR2.add(immreg).add(R6).setResult(XYOR2out);
        XYMP2.setName("XYH");
        XYMP3.setName("XYL");
        XYMP1.addIn(REGout).addIn(IR15_0).addControl(XYANDout).setResult(OPR);
        XYMP2.addIn(MDRout).addIn(OPRH).addControl(XYOR1out).setResult(XYMP2out);
        XYMP3.addIn(MDRout).addIn(OPRL).addControl(XYOR2out).setResult(XYMP3out);
        XH.setLoadSignal(ldXH).setResult(XHout);
        XL.setLoadSignal(ldXL).setResult(XLout);
        YH.setLoadSignal(ldYH).setResult(YHout);
        YL.setLoadSignal(ldYL).setResult(YLout);

        // Coordinates
        XYMP1.setCoords(60, 160);
        XYAND.rotate(270).setCoords(98, 300);
        XYInv.setCoords(XYAND.getUpperInv2Position().getX1(), XYAND.getUpperInv2Position().getY1());
        XYMP2.setCoords(240, 60);
        XYOR1.rotate(180).setCoords(300, 200);
        XYMP3.setCoords(240, 260);
        XYOR2.rotate(180).setCoords(300, 400);
        XH.setCoords(410, 150);
        YH.setCoords(600, 150);
        XL.setCoords(410, 350);
        YL.setCoords(600, 350);
    }

    private static void tabDISP(){
        // Create stuff
        DISPMP1 = new GMMultiplexer(8, 2);
        DISPMP2 = new GMMultiplexer(8, 2);
        DISPMP3 = new GMMultiplexer(16, 2);
        DISPMP4 = new GMMultiplexer(16, 4);
        DISPADD = new GAdder(16, DISPMP4out, DISPMP3out);
        DISPAND1 = new GAND();
        DISPAND2 = new GAND();
        DISPOR1 = new GOR();
        DISPOR2 = new GOR();
        DISPOR3 = new GOR();
        TEMPDISP = new GRegister(16, 0, DISPout, "TEMPDISP");

        // Logics
        DISPMP1.setName("MX1");
        DISPMP2.setName("MX2");
        DISPMP3.setName("MX3");
        DISPMP4.setName("MX4");
        DISPAND1.add(IR23).add(BNZ).setResult(DISPAND1out);
        DISPAND2.add(IR15).add(L3).setResult(DISPAND2out);
        DISPOR1.add(DISPAND1out).add(DISPAND2out).setResult(DISPOR1out);
        DISPMP1.addIn(zero8).addIn(ff8).addControl(DISPOR1out).setResult(DISPMP1out);
        DISPMP2.addIn(IR15_8).addIn(IR23_16).addControl(BNZ).setResult(DISPMP2out);
        DISPOR3.add(regind).add(mem).setResult(DISPOR3out);
        DISPMP3.addIn(DISPMP3in).addIn(zero16).addControl(DISPOR3out).setResult(DISPMP3out);
        DISPOR2.add(rel).add(BNZ).setResult(DISPOR2out);
        DISPMP4.addIn(REGout).addIn(PCout).addIn(IR15_0);
        DISPMP4.addControl(DISPOR2out).addControl(mem).setResult(DISPMP4out);
        DISPADD.setResult(DISPout);
        TEMPDISP.setLoadSignal(ldTD).setResult(TEMPDISPout);

        // Coordinates
        DISPMP1.rotate().setCoords(150, 60);
        DISPOR1.rotate(180).setCoords(300, 97);
        DISPAND1.rotate(180).setCoords(360, 70);
        DISPAND2.rotate(180).setCoords(360, 120);
        DISPMP2.rotate().setCoords(470, 60);
        DISPMP3.rotate().setCoords(330, 240);
        DISPOR3.rotate(180).setCoords(480, 277);
        DISPMP4.rotate().setCoords(70, 240);
        DISPOR2.rotate(180).setCoords(220, 262);
        DISPADD.setCoords(210, 400);
        TEMPDISP.setCoords(460, 400);
    }

    private static void tabPSW1(){
        // Create stuff
        PSW1And1 = new GAND();
        PSW1And2 = new GAND();
        PSW1And3 = new GAND();
        PSW1And4 = new GAND();
        PSW1And5 = new GAND();
        PSW1And6 = new GAND();
        PSW1And7 = new GAND();
        PSW1And8 = new GAND();
        PSW1And9 = new GAND();
        PSW1And10 = new GAND();
        PSW1And11 = new GAND();
        PSW1And12 = new GAND();
        clPSWTAnd = new GAND();
        stPSWTAnd = new GAND();
        clPSWIAnd = new GAND();
        stPSWIAnd = new GAND();
        PSW1Or1 = new GOR();
        PSW1Or2 = new GOR();
        PSW1Or3 = new GOR();
        PSW1Or4 = new GOR();
        PSW1Or5 = new GOR();
        PSW1Or6 = new GOR();
        PSW1Or7 = new GOR();
        PSW1Or8 = new GOR();
        clPSWTOr = new GOR();
        clPSWIOr = new GOR();
        PSW1RS1 = new GRSFlipFlop();
        PSW1RS2 = new GRSFlipFlop();
        PSW1RS3 = new GRSFlipFlop();
        PSW1RS4 = new GRSFlipFlop();
        PSW1Inv1 = new GInverter(prL0, PSW1Inv1Result);
        PSW1Inv2 = new GInverter(MDR4, PSW1Inv2Result);
        PSW1Inv3 = new GInverter(MDR6, PSW1Inv3Result);
        PSW1Inv4 = new GInverter(prL1, PSW1Inv4Result);
        PSW1Inv5 = new GInverter(MDR5, PSW1Inv5Result);
        PSW1Inv6 = new GInverter(MDR7, PSW1Inv6Result);

        //Logics
        //Gore Levo
        PSW1And1.add(ldPSWL).add(prL0);
        PSW1And1.setResult(PSW1And1Result);

        PSW1And2.add(PSWin).add(MDR4);
        PSW1And2.setResult(PSW1And2Result);

        PSW1Or1.add(PSW1And1Result).add(PSW1And2Result);
        PSW1Or1.setResult(PSW1Or1Result);

        PSW1And4.add(ldPSWL).add(PSW1Inv1Result);
        PSW1And4.setResult(PSW1And4Result);

        PSW1And5.add(PSWin).add(PSW1Inv2Result);
        PSW1And5.setResult(PSW1And5Result);

        PSW1Or3.add(PSW1And4Result).add(PSW1And5Result);
        PSW1Or3.setResult(PSW1Or3Result);

        PSW1RS1.setSSignal(PSW1Or1Result);
        PSW1RS1.setRSignal(PSW1Or3Result);
        PSW1RS1.setResult(PSWL0);
        //Dole Levo
        PSW1And7.add(ldPSWL).add(prL1);
        PSW1And7.setResult(PSW1And7Result);

        PSW1And8.add(PSWin).add(MDR5);
        PSW1And8.setResult(PSW1And8Result);

        PSW1Or5.add(PSW1And7Result).add(PSW1And8Result);
        PSW1Or5.setResult(PSW1Or5Result);

        PSW1And10.add(ldPSWL).add(PSW1Inv4Result);
        PSW1And10.setResult(PSW1And10Result);

        PSW1And11.add(PSWin).add(PSW1Inv5Result);
        PSW1And11.setResult(PSW1And11Result);

        PSW1Or7.add(PSW1And10Result).add(PSW1And11Result);
        PSW1Or7.setResult(PSW1Or7Result);

        PSW1RS3.setSSignal(PSW1Or5Result);
        PSW1RS3.setRSignal(PSW1Or7Result);
        PSW1RS3.setResult(PSWL1);
        //Gore Desno
        PSW1And3.add(PSWin).add(MDR6);
        PSW1And3.setResult(PSW1And3Result);

        PSW1Or2.add(PSW1And3Result).add(stPSWT);
        PSW1Or2.setResult(PSW1Or2Result);

        PSW1And6.add(PSWin).add(PSW1Inv3Result);
        PSW1And6.setResult(PSW1And6Result);

        PSW1Or4.add(clPSWT).add(PSW1And6Result);
        PSW1Or4.setResult(PSW1Or4Result);

        PSW1RS2.setSSignal(PSW1Or2Result);
        PSW1RS2.setRSignal(PSW1Or4Result);
        PSW1RS2.setResult(PSWT);
        //Dole Desno
        PSW1And9.add(PSWin).add(MDR7);
        PSW1And9.setResult(PSW1And9Result);

        PSW1Or6.add(PSW1And9Result).add(stPSWI);
        PSW1Or6.setResult(PSW1Or6Result);

        PSW1And12.add(PSWin).add(PSW1Inv6Result);
        PSW1And12.setResult(PSW1And12Result);

        PSW1Or8.add(clPSWI).add(PSW1And12Result);
        PSW1Or8.setResult(PSW1Or8Result);

        PSW1RS4.setSSignal(PSW1Or6Result);
        PSW1RS4.setRSignal(PSW1Or8Result);
        PSW1RS4.setResult(PSWI);
        //Extra deo
        clPSWTAnd.add(ldCONTROL).add(TRPD);
        clPSWTAnd.setResult(clPSWTAndResult);
        clPSWTOr.add(ack).add(clPSWTAndResult);
        clPSWTOr.setResult(clPSWT);

        stPSWTAnd.add(ldCONTROL).add(TRPE);
        stPSWTAnd.setResult(stPSWT);

        clPSWIAnd.add(ldCONTROL).add(INTD);
        clPSWIAnd.setResult(clPSWIAndResult);
        clPSWIOr.add(ack).add(clPSWIAndResult);
        clPSWIOr.setResult(clPSWI);

        stPSWIAnd.add(ldCONTROL).add(INTE);
        stPSWIAnd.setResult(stPSWI);

        //Coordinates
        PSW1And1.setCoords(60, 70);
        PSW1And2.setCoords(160, 45);
        PSW1And3.setCoords(500, 45);
        PSW1And4.setCoords(60, 165);
        PSW1And5.setCoords(160, 140);
        PSW1And6.setCoords(500, 140);

        PSW1And7.setCoords(60, 250);
        PSW1And8.setCoords(160, 225);
        PSW1And9.setCoords(500, 225);
        PSW1And10.setCoords(60, 345);
        PSW1And11.setCoords(160, 320);
        PSW1And12.setCoords(500, 320);

        PSW1Or1.setCoords(240, 50);
        PSW1Or2.setCoords(580, 50);
        PSW1Or3.setCoords(240, 145);
        PSW1Or4.setCoords(580, 145);
        PSW1Or5.setCoords(240, 230);
        PSW1Or6.setCoords(580, 230);
        PSW1Or7.setCoords(240, 325);
        PSW1Or8.setCoords(580, 325);

        PSW1RS1.setCoords(300, 50);
        PSW1RS2.setCoords(640, 50);
        PSW1RS3.setCoords(300, 230);
        PSW1RS4.setCoords(640, 230);

        clPSWTAnd.setCoords(80, 430);
        clPSWTOr.setCoords(140, 422);
        stPSWTAnd.setCoords(300, 430);

        clPSWIAnd.setCoords(520, 430);
        clPSWIOr.setCoords(580, 422);
        stPSWIAnd.setCoords(730, 430);

        PSW1Inv1.setCoords(PSW1And4.getLowerInv2Position().getX1(), PSW1And4.getLowerInv2Position().getY1());
        PSW1Inv2.setCoords(PSW1And5.getLowerInv2Position().getX1(), PSW1And5.getLowerInv2Position().getY1());
        PSW1Inv3.setCoords(PSW1And6.getLowerInv2Position().getX1(), PSW1And6.getLowerInv2Position().getY1());
        PSW1Inv4.setCoords(PSW1And10.getLowerInv2Position().getX1(), PSW1And10.getLowerInv2Position().getY1());
        PSW1Inv5.setCoords(PSW1And11.getLowerInv2Position().getX1(), PSW1And11.getLowerInv2Position().getY1());
        PSW1Inv6.setCoords(PSW1And12.getLowerInv2Position().getX1(), PSW1And12.getLowerInv2Position().getY1());
    }

    private static void tabPSW2(){
        // Create stuff (svi konstruktori)
        PSW2And1 = new GAND();
        PSW2And2 = new GAND();
        PSW2And3 = new GAND();
        PSW2And4 = new GAND();
        PSW2And5 = new GAND();
        PSW2And6 = new GAND();
        PSW2And7 = new GAND();
        PSW2And8 = new GAND();
        PSW2And9 = new GAND();
        PSW2And10 = new GAND();
        PSW2And11 = new GAND();
        PSW2And12 = new GAND();
        PSW2And13 = new GAND();
        PSW2And14 = new GAND();
        PSW2And15 = new GAND();
        PSW2And16 = new GAND();
        PSW2CondAnd = new GAND();
        PSW2Or1 = new GOR();
        PSW2Or2 = new GOR();
        PSW2Or3 = new GOR();
        PSW2Or4 = new GOR();
        PSW2Or5 = new GOR();
        PSW2Or6 = new GOR();
        PSW2Or7 = new GOR();
        PSW2Or8 = new GOR();
        PSW2RS1 = new GRSFlipFlop();
        PSW2RS2 = new GRSFlipFlop();
        PSW2RS3 = new GRSFlipFlop();
        PSW2RS4 = new GRSFlipFlop();
        PSW2Inv1 = new GInverter(aluN, PSW2Inv1Result);
        PSW2Inv2 = new GInverter(MDR0, PSW2Inv2Result);
        PSW2Inv3 = new GInverter(aluC, PSW2Inv3Result);
        PSW2Inv4 = new GInverter(MDR2, PSW2Inv4Result);
        PSW2Inv5 = new GInverter(aluZ, PSW2Inv5Result);
        PSW2Inv6 = new GInverter(MDR1, PSW2Inv6Result);
        PSW2Inv7 = new GInverter(aluV, PSW2Inv7Result);
        PSW2Inv8 = new GInverter(MDR3, PSW2Inv8Result);
        PSW2CondInv = new GInverter(PSWZ, PSW2CondInvResult);

        //Logics
        //Gore Levo
        //Gornji par and-ova + or
        PSW2And1.add(ldFLAGS).add(aluN);
        PSW2And1.setResult(PSW2And1Result);

        PSW2And2.add(PSWin).add(MDR0);
        PSW2And2.setResult(PSW2And2Result);

        PSW2Or1.add(PSW2And1Result).add(PSW2And2Result);
        PSW2Or1.setResult(PSW2Or1Result);
        //Donji par and-ova + or
        PSW2And5.add(ldFLAGS).add(PSW2Inv1Result);
        PSW2And5.setResult(PSW2And5Result);

        PSW2And6.add(PSWin).add(PSW2Inv2Result);
        PSW2And6.setResult(PSW2And6Result);

        PSW2Or3.add(PSW2And5Result).add(PSW2And6Result);
        PSW2Or3.setResult(PSW2Or3Result);
        //Prvi Flip Flop
        PSW2RS1.setSSignal(PSW2Or1Result);
        PSW2RS1.setRSignal(PSW2Or3Result);
        PSW2RS1.setResult(PSWN);
        //Gore Desno
        //Gornji par and-ova + or
        PSW2And3.add(ldFLAGS).add(aluC);
        PSW2And3.setResult(PSW2And3Result);

        PSW2And4.add(PSWin).add(MDR2);
        PSW2And4.setResult(PSW2And4Result);

        PSW2Or2.add(PSW2And3Result).add(PSW2And4Result);
        PSW2Or2.setResult(PSW2Or2Result);
        //Donji par and-ova + or
        PSW2And7.add(ldFLAGS).add(PSW2Inv3Result);
        PSW2And7.setResult(PSW2And7Result);

        PSW2And8.add(PSWin).add(PSW2Inv4Result);
        PSW2And8.setResult(PSW2And8Result);

        PSW2Or4.add(PSW2And7Result).add(PSW2And8Result);
        PSW2Or4.setResult(PSW2Or4Result);
        //Prvi Flip Flop
        PSW2RS2.setSSignal(PSW2Or2Result);
        PSW2RS2.setRSignal(PSW2Or4Result);
        PSW2RS2.setResult(PSWC);

        //Dole levo
        //Gornji par and-ova + or
        PSW2And9.add(ldFLAGS).add(aluZ);
        PSW2And9.setResult(PSW2And9Result);

        PSW2And10.add(PSWin).add(MDR1);
        PSW2And10.setResult(PSW2And10Result);

        PSW2Or5.add(PSW2And9Result).add(PSW2And10Result);
        PSW2Or5.setResult(PSW2Or5Result);
        //Donji par and-ova + or
        PSW2And13.add(ldFLAGS).add(PSW2Inv5Result);
        PSW2And13.setResult(PSW2And13Result);

        PSW2And14.add(PSWin).add(PSW2Inv6Result);
        PSW2And14.setResult(PSW2And14Result);

        PSW2Or7.add(PSW2And13Result).add(PSW2And14Result);
        PSW2Or7.setResult(PSW2Or7Result);
        //Prvi Flip Flop
        PSW2RS3.setSSignal(PSW2Or5Result);
        PSW2RS3.setRSignal(PSW2Or7Result);
        PSW2RS3.setResult(PSWZ);

        //Dole desno
        //Gornji par and-ova + or
        PSW2And11.add(ldFLAGS).add(aluV);
        PSW2And11.setResult(PSW2And11Result);

        PSW2And12.add(PSWin).add(MDR3);
        PSW2And12.setResult(PSW2And12Result);

        PSW2Or6.add(PSW2And11Result).add(PSW2And12Result);
        PSW2Or6.setResult(PSW2Or6Result);
        //Donji par and-ova + or
        PSW2And15.add(ldFLAGS).add(PSW2Inv7Result);
        PSW2And15.setResult(PSW2And15Result);

        PSW2And16.add(PSWin).add(PSW2Inv8Result);
        PSW2And16.setResult(PSW2And16Result);

        PSW2Or8.add(PSW2And15Result).add(PSW2And16Result);
        PSW2Or8.setResult(PSW2Or8Result);
        //Prvi Flip Flop
        PSW2RS4.setSSignal(PSW2Or6Result);
        PSW2RS4.setRSignal(PSW2Or8Result);
        PSW2RS4.setResult(PSWV);
        //Extra deo
        PSW2CondAnd.add(BNZ).add(PSW2CondInvResult);
        PSW2CondAnd.setResult(cond);

        //Coordinates
        PSW2And1.setCoords(60, 70);
        PSW2And2.setCoords(160, 45);
        PSW2And3.setCoords(470, 70);
        PSW2And4.setCoords(570, 45);
        PSW2And5.setCoords(60, 165);
        PSW2And6.setCoords(160, 140);
        PSW2And7.setCoords(470, 165);
        PSW2And8.setCoords(570, 140);

        PSW2And9.setCoords(60, 250);
        PSW2And10.setCoords(160, 225);
        PSW2And11.setCoords(470, 250);
        PSW2And12.setCoords(570, 225);
        PSW2And13.setCoords(60, 345);
        PSW2And14.setCoords(160, 320);
        PSW2And15.setCoords(470, 345);
        PSW2And16.setCoords(570, 320);

        PSW2Or1.setCoords(220, 50);
        PSW2Or2.setCoords(630, 50);
        PSW2Or3.setCoords(220, 145);
        PSW2Or4.setCoords(630, 145);
        PSW2Or5.setCoords(220, 230);
        PSW2Or6.setCoords(630, 230);
        PSW2Or7.setCoords(220, 325);
        PSW2Or8.setCoords(630, 325);

        PSW2RS1.setCoords(290, 50);
        PSW2RS2.setCoords(700, 50);
        PSW2RS3.setCoords(290, 230);
        PSW2RS4.setCoords(700, 230);

        PSW2CondAnd.setCoords(60, 430);

        PSW2Inv1.setCoords(PSW2And5.getLowerInv2Position().getX1(), PSW2And5.getLowerInv2Position().getY1());
        PSW2Inv2.setCoords(PSW2And6.getLowerInv2Position().getX1(), PSW2And6.getLowerInv2Position().getY1());
        PSW2Inv3.setCoords(PSW2And7.getLowerInv2Position().getX1(), PSW2And7.getLowerInv2Position().getY1());
        PSW2Inv4.setCoords(PSW2And8.getLowerInv2Position().getX1(), PSW2And8.getLowerInv2Position().getY1());
        PSW2Inv5.setCoords(PSW2And13.getLowerInv2Position().getX1(), PSW2And13.getLowerInv2Position().getY1());
        PSW2Inv6.setCoords(PSW2And14.getLowerInv2Position().getX1(), PSW2And14.getLowerInv2Position().getY1());
        PSW2Inv7.setCoords(PSW2And15.getLowerInv2Position().getX1(), PSW2And15.getLowerInv2Position().getY1());
        PSW2Inv8.setCoords(PSW2And16.getLowerInv2Position().getX1(), PSW2And16.getLowerInv2Position().getY1());

        PSW2CondInv.setCoords(PSW2CondAnd.getLowerInv2Position().getX1(), PSW2CondAnd.getLowerInv2Position().getY1());
    }

    private static void tabALU(){
        // Create stuff
        ALU = new GALU(16, Xout, Yout);
        TEMP = new GRegister(16, 0, Fout, "TEMP");
        ALURS = new GRSFlipFlop(new Signal(0), ALUANDout);
        ALUAND1 = new GAND();
        ALUAND2 = new GAND();
        ALUAND3 = new GAND();
        ALUAND4 = new GAND();
        ALUAND5 = new GAND();
        ALUAND6 = new GAND();
        ALUCE = new ClickableElement(12, "Indicators");

        // Logics
        ALUAND1.add(aluODO).add(ADD).setResult(aluADD);
        ALUAND2.add(aluODO).add(AND).setResult(aluAND);
        ALUAND3.add(aluOJO).add(INC).setResult(aluINC);
        ALUAND4.add(aluOJO).add(DEC).setResult(aluDEC);
        ALUAND5.add(aluOJO).add(ASR).setResult(aluASR);
        ALU.setAdd(aluADD).setAnd(aluAND).setInc(aluINC).setDec(aluDEC).setAsr(aluASR).setTrans(transX);
        ALU.setCBit(C16).setResult(Fout);
        TEMP.setLoadSignal(ldTEMP).setResult(TEMPout);
        ALUAND6.add(ldCONTROL).add(HALT).setResult(ALUANDout);
        ALURS.setResult(halt).setResultNot(haltCompl);

        // Coordinates
        ALU.setCoords(220, 100);
        TEMP.setCoords(289, 300);
        ALUCE.setSize(200, 100);
        ALUCE.setCoords(500, 300);
        ALURS.setCoords(120, 300);
        ALUAND1.setCoords(160, 106);
        ALUAND2.setCoords(160, 136);
        ALUAND3.rotate(180).setCoords(500, 106);
        ALUAND4.rotate(180).setCoords(500, 136);
        ALUAND5.rotate(180).setCoords(500, 166);
        ALUAND6.setCoords(70, 305);
    }

    private static void tabIndicators(){
        // Create stuff
        AIAND1 = new GAND();
        AIAND2 = new GAND();
        AIAND3 = new GAND();
        AIAND4 = new GAND();
        AIAND5 = new GAND();
        AIAND6 = new GAND();
        AIAND7 = new GAND();
        AIAND8 = new GAND();
        AIOR1 = new GOR();
        AIOR2 = new GOR();
        AIOR3 = new GOR();
        AIOR4 = new GOR();
        AIOR5 = new GOR();
        AIInv1 = new GInverter(C16, C16not);
        AIInv2 = new GInverter(F15, F15not1);
        AIInv3 = new GInverter(X15, X15not1);
        AIInv4 = new GInverter(Y15, Y15not);
        AIInv5 = new GInverter(X15, X15not2);
        AIInv6 = new GInverter(F15, F15not2);

        // Logics
        F15.link(aluN);
        AIAND1.add(C16not).add(DEC).setResult(AIAND1out);
        AIOR1.add(ADD).add(INC).setResult(AIOR1out);
        AIAND2.add(C16).add(AIOR1out).setResult(AIAND2out);
        AIAND3.add(X0).add(ASR).setResult(AIAND3out);
        AIOR2.add(AIAND1out).add(AIAND2out).add(AIAND3out).setResult(aluC);
        AIAND4.add(X15).add(Y15).add(F15not1).setResult(AIAND4out);
        AIAND5.add(X15not1).add(Y15not).add(F15).setResult(AIAND5out);
        AIOR3.add(AIAND4out).add(AIAND5out).setResult(AIOR3out);
        AIAND6.add(AIOR3out).add(ADD).setResult(AIAND6out);
        AIAND7.add(INC).add(X15not2).add(F15).setResult(AIAND7out);
        AIAND8.add(DEC).add(X15).add(F15not2).setResult(AIAND8out);
        AIOR4.add(AIAND6out).add(AIAND7out).add(AIAND8out).setResult(aluV);
        AIOR5.add(F0).add(F1).add(F2).add(F3).add(F4).add(F5).add(F6).add(F7).add(F8).add(F9)
             .add(F10).add(F11).add(F12).add(F13).add(F14).add(F15).not().setResult(aluZ);

        // Coordinates
        AIOR1.setCoords(60, 108);
        AIAND1.setCoords(140, 60);
        AIAND2.setCoords(140, 100);
        AIAND3.setCoords(140, 140);
        AIOR2.setCoords(230, 100);
        AIAND4.setCoords(140, 200);
        AIAND5.setCoords(140, 260);
        AIOR3.setCoords(230, 230);
        AIAND6.setCoords(300, 238);
        AIAND7.setCoords(300, 290);
        AIAND8.setCoords(300, 340);
        AIOR4.setCoords(380, 290);
        AIOR5.setCoords(140, 390);
        AIInv1.setCoords(AIAND1.getUpperInv2Position().getX1(), AIAND1.getUpperInv2Position().getY1());
        AIInv2.setCoords(AIAND4.getLowerInv3Position().getX1(), AIAND4.getLowerInv3Position().getY1());
        AIInv3.setCoords(AIAND5.getUpperInv3Position().getX1(), AIAND5.getUpperInv3Position().getY1());
        AIInv4.setCoords(AIAND5.getMiddleInv3Position().getX1(), AIAND5.getMiddleInv3Position().getY1());
        AIInv5.setCoords(AIAND7.getMiddleInv3Position().getX1(), AIAND7.getMiddleInv3Position().getY1());
        AIInv6.setCoords(AIAND8.getLowerInv3Position().getX1(), AIAND8.getLowerInv3Position().getY1());
    }

    private static void tabMaskedInterruptsACK(){
        //Creating stuff
        MIARSLeft1 = new GRSFlipFlop();
        MIARSRight1 = new GRSFlipFlop();
        MIARSLeft2 = new GRSFlipFlop();
        MIARSRight2 = new GRSFlipFlop();
        MIARSLeft3 = new GRSFlipFlop();
        MIARSRight3 = new GRSFlipFlop();
        MIARSLeft4 = new GRSFlipFlop();
        MIARSRight4 = new GRSFlipFlop();
        MIAAnd1 = new GAND();
        MIAAnd2 = new GAND();
        MIAAnd3 = new GAND();
        MIAAnd4 = new GAND();

        //Logics
        MIARSLeft1.setSSignal(inm);
        MIARSLeft1.setRSignal(ackPRINM);
        MIARSLeft1.setResult(Finm);
        MIARSLeft2.setSSignal(intr3);
        MIARSLeft2.setRSignal(ackPER3);
        MIARSLeft2.setResult(Fintr3);
        MIARSLeft3.setSSignal(intr2);
        MIARSLeft3.setRSignal(ackPER2);
        MIARSLeft3.setResult(Fintr2);
        MIARSLeft4.setSSignal(intr1);
        MIARSLeft4.setRSignal(ackPER1);
        MIARSLeft4.setResult(Fintr1);

        MIAAnd1.add(Finm).add(ldINTEXT);
        MIAAnd1.setResult(MIAAnd1Result);

        MIAAnd2.add(Fintr3).add(ldINTEXT);
        MIAAnd2.setResult(MIAAnd2Result);

        MIAAnd3.add(Fintr2).add(ldINTEXT);
        MIAAnd3.setResult(MIAAnd3Result);

        MIAAnd4.add(Fintr1).add(ldINTEXT);
        MIAAnd4.setResult(MIAAnd4Result);

        MIARSRight1.setSSignal(MIAAnd1Result);
        MIARSRight1.setRSignal(ackPRINM);
        MIARSRight1.setResult(PRINM);
        MIARSRight2.setSSignal(MIAAnd2Result);
        MIARSRight2.setRSignal(ackPER3);
        MIARSRight2.setResult(PRPER3);
        MIARSRight3.setSSignal(MIAAnd3Result);
        MIARSRight3.setRSignal(ackPER2);
        MIARSRight3.setResult(PRPER2);
        MIARSRight4.setSSignal(MIAAnd4Result);
        MIARSRight4.setRSignal(ackPER1);
        MIARSRight4.setResult(PRPER1);

        //Coordinatates
        MIARSLeft1.setCoords(100, 100);
        MIARSRight1.setCoords(300, 100);
        MIARSLeft3.setCoords(450, 100);
        MIARSRight3.setCoords(650, 100);

        MIARSLeft2.setCoords(100, 300);
        MIARSRight2.setCoords(300, 300);
        MIARSLeft4.setCoords(450, 300);
        MIARSRight4.setCoords(650, 300);

        MIAAnd1.setCoords(250, 105);
        MIAAnd2.setCoords(250, 305);
        MIAAnd3.setCoords(600, 105);
        MIAAnd4.setCoords(600, 305);
    }

    private static void tabIMR(){
        // Create stuff
        IMROR = new GOR();
        IMRAND1 = new GAND();
        IMRAND2 = new GAND();
        IMRAND3 = new GAND();
        IMRAND4 = new GAND();
        IMRAND5 = new GAND();
        IMRAND6 = new GAND();
        IMRAND7 = new GAND();
        IMRAND8 = new GAND();
        IMRInv1 = new GInverter(REGout3, REGout3not);
        IMRInv2 = new GInverter(REGout2, REGout2not);
        IMRInv3 = new GInverter(REGout1, REGout1not);
        IMRRS3 = new GRSFlipFlop(IMRAND2out, IMRAND1out);
        IMRRS2 = new GRSFlipFlop(IMRAND4out, IMRAND3out);
        IMRRS1 = new GRSFlipFlop(IMRAND6out, IMRAND5out);
        PRINTRS = new GRSFlipFlop(ackPRINT, stPRINT);
        PRADRRS = new GRSFlipFlop(ackADR, IMRAND7out);
        PROPRRS = new GRSFlipFlop(ackOPR, IMRAND8out);

        // Logics
        IMROR.add(ldCONTROL).add(STIMR).setResult(IMRORout);
        IMRAND1.add(IMRORout).add(REGout3).setResult(IMRAND1out);
        IMRAND2.add(IMRORout).add(REGout3not).setResult(IMRAND2out);
        IMRAND3.add(IMRORout).add(REGout2).setResult(IMRAND3out);
        IMRAND4.add(IMRORout).add(REGout2not).setResult(IMRAND4out);
        IMRAND5.add(IMRORout).add(REGout1).setResult(IMRAND5out);
        IMRAND6.add(IMRORout).add(REGout1not).setResult(IMRAND6out);
        IMRRS3.setResult(IMR3);
        IMRRS2.setResult(IMR2);
        IMRRS1.setResult(IMR1);
        IMRAND7.add(grADR).add(ldPRADROPR).setResult(IMRAND7out);
        IMRAND8.add(ldPRADROPR).add(grOPR).setResult(IMRAND8out);
        PRINTRS.setResult(PRINT);
        PRADRRS.setResult(PRADR);
        PROPRRS.setResult(PROPR);

        // Coordinates
        IMROR.setCoords(60, 60);
        IMRAND1.setCoords(130, 85);
        IMRAND2.setCoords(130, 130);
        IMRAND3.setCoords(130, 205);
        IMRAND4.setCoords(130, 250);
        IMRAND5.setCoords(130, 325);
        IMRAND6.setCoords(130, 370);
        IMRInv1.setCoords(IMRAND2.getLowerInv2Position().getX1(), IMRAND2.getLowerInv2Position().getY1());
        IMRInv2.setCoords(IMRAND4.getLowerInv2Position().getX1(), IMRAND4.getLowerInv2Position().getY1());
        IMRInv3.setCoords(IMRAND6.getLowerInv2Position().getX1(), IMRAND6.getLowerInv2Position().getY1());
        IMRRS3.setCoords(190, 80);
        IMRRS2.setCoords(190, 200);
        IMRRS1.setCoords(190, 320);
        IMRAND7.setCoords(370, 205);
        IMRAND8.setCoords(370, 325);
        PRINTRS.setCoords(430, 80);
        PRADRRS.setCoords(430, 200);
        PROPRRS.setCoords(430, 320);
    }

    private static void tabMaskedInterrupts(){
        MILeft = new GAND();
        MIMiddle = new GAND();
        MIRight = new GAND();
        MIFarRight = new GAND();
        MIOr = new GOR();
        MIComparator = new GComparator();
        MICoder = new GEncoder(4);

        //Logics
        MILeft.add(IMR1).add(PRPER1);
        MIMiddle.add(IMR2).add(PRPER2);
        MIRight.add(IMR3).add(PRPER3);
        MILeft.setResult(MILeftResult);
        MIMiddle.setResult(MIMiddleResult);
        MIRight.setResult(MIRightResult);
        MICoder.add(one).add(MILeftResult).add(MIMiddleResult).add(MIRightResult);
        MICoder.setResult(MICoderOut);
        MIComparator.setA(MIA).setB(MIB);
        MIComparator.setGResult(MIComparatorG);
        MIComparator.setEResult(MIComparatorE);
        MIComparator.setLResult(MIComparatorL);
        MIOr.add(MILeftResult).add(MIRightResult).add(MIMiddleResult);
        MIOr.setResult(MIOrResult);
        MIFarRight.add(MIOrResult).add(PSWI).add(MIComparatorG);
        MIFarRight.setResult(PRPER);

        //Coordinates
        MILeft.setCoords(70, 70);
        MILeft.rotate(90);
        MIMiddle.setCoords(145, 70);
        MIMiddle.rotate(90);
        MIRight.setCoords(220, 70);
        MIRight.rotate(90);
        MIOr.setCoords(295, 150);
        MIFarRight.setCoords(370, 150);
        MICoder.setCoords(100, 200);
        MIComparator.setCoords(110, 400);
        MICoder.rotate();
    }

    private static void tabInterrupts(){
        //Creating stuff
        IVTP = new GRegister(16, 0x0, null, "IVTP");
        ICoder = new GEncoder(4);
        IDecoder = new GDecoder(3);
        IMMP1 = new GMMultiplexer(2, 2);
        IMMP2 = new GMMultiplexer(8, 2);
        IAdd = new GAdder(16);
        IOrUpper = new GOR();
        IOrLower = new GOR();
        IAnd1 = new GAND();
        IAnd2 = new GAND();
        IAnd3 = new GAND();

        //Logics
        ICoder.add(PSWT).add(PRINM).add(PRADR).add(PROPR);
        ICoder.setResult(IMMP1in0);
        ICoder.setWBit(ICoderW);
        IMMP1.addIn(IMMP1in0).addIn(IMMP1in1);

        IOrLower.not();
        IOrLower.add(PROPR).add(PRADR).add(PRINM);
        IOrLower.setResult(IOrLowerResult);

        IAnd2.add(IOrLowerResult).add(PRPER);
        IAnd2.setResult(IMMP1S0);

        IMMP1.addControl(IMMP1S0);
        IMMP1.setResult(IMMP1Out);

        IAnd1.add(ack).add(IMMP1S0);
        IAnd1.setResult(ldPSWL);

        IOrUpper.not();
        IOrUpper.add(ICoderW).add(PRPER).add(INT);
        IOrUpper.setResult(PREKIDCompl);

        IDecoder.add(IMMP1Out0).add(IMMP1Out1).add(IMMP1S0);
        IDecoder.setEnableBit(ack);
        IDecoder.setResult(IDecoderOut);

        IAnd3.add(ack).add(INT);
        IAnd3.setResult(ackINT);

        IMMP2.addControl(INT);

        IMMP2.addIn(IMMP2In).addIn(IR23_16);
        IMMP2.setResult(IMMP2Out);

        IVTP.setResult(IVTPout);

        IAdd.setA(IVTPout);
        IAdd.setB(IADDin1);
        IAdd.setResult(ADRIVT);

        //Coordinates
        ICoder.setCoords(60, 20);
        IMMP1.setCoords(180, 140);
        IMMP1.setName("MP1");
        IOrUpper.setCoords(390, 40);
        IAnd1.setCoords(550, 40);
        IOrLower.setCoords(550, 100);
        IOrLower.rotate(180);
        IAnd2.setCoords(470, 108);
        IAnd2.rotate(180);
        IDecoder.setCoords(570, 160);
        IVTP.setCoords(80, 300);
        IAdd.setCoords(200, 400);
        IMMP2.setCoords(380, 250);
        IMMP2.setName("MP2");
        IAnd3.setCoords(690, 40);
        IMMP1.rotate();
        IMMP2.rotate();
    }

    private static void tabArbitrator(){
        //Creating stuff
        ACoder = new GEncoder(4);
        ADecoder = new GDecoder(2);
        ARSLeft = new GRSFlipFlop();
        ARSRight = new GRSFlipFlop();
        AAndLeft = new GAND();
        AAndRight = new GAND();
        AInverter = new GInverter(brqSTOP);
        ATriStateLeft1 = new GMTriState(ATriStateLeft2Result, one);
        ATriStateLeft2 = new GMTriState(ATriStateRightResult, one);
        ATriStateRight = new GTriState(one, busHOLD);
        AOr = new GOR();

        //Logics
        ATriStateRight.setResult(ATriStateRightResult).not();
        BUSYBUS.registerSignal(ATriStateRightResult);
        BUSYBUS.put(ATriStateRightResult);
        ATriStateLeft2.setResult(ATriStateLeft2Result).not();
        ATriStateLeft1.setResult(ATriStateLeft1MResult).not();
        AAndLeft.add(ATriStateLeft1Result).add(BG3);
        AAndLeft.setResult(AAndLeftResult);
        ARSLeft.setSSignal(AAndLeftResult);
        ARSLeft.setRSignal(brqSTOP);
        ARSLeft.setResult(busHOLD);
        ARSRight.setSSignal(brqSTART);
        ARSRight.setRSignal(brqSTOP);
        ARSRight.setResult(bSTART);
        AOr.add(brqSTART).add(bSTART);
        AOr.setResult(AOrResult);
        AInverter.setResult(AInverterResult);
        AAndRight.add(AOrResult).add(AInverterResult);
        AAndRight.setResult(BRQ3);
        ACoder.add(BRQ0).add(BRQ1).add(BRQ2).add(BRQ3);
        ACoder.setResult(ACoderOut).setWBit(ACoderW);
        ADecoder.add(ACoderOut0).add(ACoderOut1);
        ADecoder.setResult(ADecoderOut).setEnableBit(ACoderW);

        //Coordinates
        ADecoder.rotate();
        ACoder.rotate();
        ATriStateLeft1.rotate(180);
        ATriStateLeft2.rotate(180);
        ACoder.rotate();
        AAndLeft.setCoords(100, 200);
        ARSLeft.setCoords(160, 195);
        ATriStateRight.setCoords(260, 170);
        ATriStateLeft1.setCoords(150, 100);
        ATriStateLeft2.setCoords(230, 100);
        ARSRight.setCoords(400, 195);
        AOr.setCoords(490, 100);
        AAndRight.setCoords(560, 105);
        AInverter.setCoords(AAndRight.getLowerInv2Position().getX1(), AAndRight.getLowerInv2Position().getY1());
        ACoder.setCoords(600, 170);
        ADecoder.setCoords(600, 310);
    }

    private static void tabSync(){
        // Create stuff
        SyncD1 = new GDFlipFlop(SyncAND1out);
        SyncD2 = new GDFlipFlop(SyncAND3out);
        SyncD3 = new GDFlipFlop(SyncOR1out);
        SyncCNT = new GCounter(3, 0, SyncCNTin);
        SyncInv1 = new GInverter(SyncCNTout2, SyncCNTout2not);
        SyncInv2 = new GInverter(SyncCNTout1, SyncCNTout1not);
        SyncAND1 = new GAND();
        SyncAND2 = new GAND();
        SyncAND3 = new GAND();
        SyncAND4 = new GAND();
        SyncAND5 = new GAND();
        SyncAND6 = new GAND();
        SyncAND7 = new GAND();
        SyncAND8 = new GAND();
        SyncOR1 = new GOR();
        SyncOR2 = new GOR();
        SyncOR3 = new GOR();
        SyncOR4 = new GOR();
        SyncOR5 = new GOR();

        // Logics
        SyncAND1.add(busHOLD).add(read).setResult(SyncAND1out);
        SyncD1.setResult(DRD).setResultNot(SyncD1Qcompl);
        SyncAND2.add(SyncAND1out).add(SyncD1Qcompl).setResult(rd);
        SyncAND3.add(busHOLD).add(write).setResult(SyncAND3out);
        SyncD2.setResult(DWR).setResultNot(SyncD2Qcompl);
        SyncAND4.add(SyncAND3out).add(SyncD2Qcompl).setResult(wr);
        SyncOR1.add(read).add(write).setResult(SyncOR1out);
        SyncD3.setResultNot(SyncD3Qcompl);
        SyncAND5.add(SyncOR1out).add(SyncD3Qcompl).setResult(brqSTART);
        SyncCNT.setDecSignal(busHOLD).setLoadSignal(brqSTART).setResult(SyncCNTout);
        SyncCNTout.bindOut(0, 2, new Signal[]{SyncCNTout0, SyncCNTout1, SyncCNTout2});
        SyncOR2.add(SyncCNTout2).add(SyncCNTout1).add(SyncCNTout0).not().setResult(SyncOR2out);
        SyncAND7.add(SyncOR2out).add(DRD).setResult(stopRD);
        SyncAND6.add(SyncCNTout2not).add(SyncCNTout1not).add(SyncCNTout0).setResult(SyncAND6out);
        SyncAND8.add(SyncAND6out).add(DWR).setResult(stopWR);
        SyncOR3.add(stopRD).add(stopWR).setResult(brqSTOP);
        SyncOR4.add(read).add(write).not().setResult(SyncOR4out);
        SyncOR5.add(brqSTOP).add(SyncOR4out).setResult(run);

        // Coordinates
        SyncAND1.setCoords(60, 72);
        SyncD1.setCoords(130, 70);
        SyncAND2.setCoords(260, 50);
        SyncAND3.setCoords(60, 202);
        SyncD2.setCoords(130, 200);
        SyncAND4.setCoords(260, 180);
        SyncOR1.setCoords(60, 332);
        SyncD3.setCoords(130, 330);
        SyncAND5.setCoords(260, 310);
        SyncCNT.setCoords(480, 70);
        SyncOR2.rotate(90).setCoords(480, 200);
        SyncAND6.rotate(90).setCoords(570, 200);
        SyncInv1.setCoords(SyncAND6.getLowerInv3Position().getX1(), SyncAND6.getLowerInv3Position().getY1());
        SyncInv2.setCoords(SyncAND6.getMiddleInv3Position().getX1(), SyncAND6.getMiddleInv3Position().getY1());
        SyncAND7.rotate(180).setCoords(430, 250);
        SyncAND8.setCoords(610, 250);
        SyncOR3.setCoords(430, 320);
        SyncOR4.setCoords(560, 320);
        SyncOR5.setCoords(630, 312);
    }

    private static void tabMARMDR() {
        // Create stuff
        MAR = new GCounter(16, 0x0, null, "MAR");
        MDR = new GRegister(8, 0x0, null, "MDR");
        mxMAR = new GMMultiplexer(16, 8);
        mxMDR = new GMMultiplexer(8, 8);
        TSRDBUS = new GTriState(rd, rdbusANDout);
        TSWRBUS = new GTriState(wr, wrbusANDout);
        TSMAR = new GMTriState(MARout, busHOLD);
        TSMDR = new GMTriState(MDRout, MDRbusANDout);
        MDRbusAND = new GAND();
        rdbusAND = new GAND();
        wrbusAND = new GAND();
        MDROR = new GOR();
        mxMAR.setName("mxMAR");
        mxMDR.setName("mxMDR");

        // Logics
        mxMAR.addIn(PCout).addIn(SPout).addIn(DISPout).addIn(ADRIVTout).addIn(Xout).addIn(TEMPDISPout).addIn(TEMPout).addIn(Yout);
        mxMAR.addControl(mxMAR0).addControl(mxMAR1).addControl(mxMAR2).setResult(mxMARout);
        DBUS.registerSignal(DBUSout);
        mxMDR.addIn(DBUSout).addIn(XHout).addIn(XLout).addIn(TEMPoutH).addIn(TEMPoutL).addIn(PCoutL).addIn(PCoutH).addIn(PSWout);
        mxMDR.addControl(mxMDR0).addControl(mxMDR1).addControl(mxMDR2).setResult(mxMDRout);
        MAR.setIncSignal(incMAR).setInSignal(mxMARout).setLoadSignal(ldMAR).setResult(MARout);
        MDROR.add(stopRD).add(ldMDR).setResult(MDRORout);
        MDR.setLoadSignal(MDRORout).setInSignal(mxMDRout).setResult(MDRout);
        MDRbusAND.add(write).add(busHOLD).setResult(MDRbusANDout);
        TSMAR.setResult(MARbus); ABUS.put(MARbus);
        TSMDR.setResult(MDRbus); DBUS.put(MDRbus);
        rdbusAND.add(read).add(busHOLD).setResult(rdbusANDout);
        wrbusAND.add(write).add(busHOLD).setResult(wrbusANDout);
        TSRDBUS.not().setResult(rdbus); RDBUS.put(rdbus);
        TSWRBUS.not().setResult(wrbus); WRBUS.put(wrbus);

        // Coordinates
        mxMAR.rotate().setCoords(100, 70);
        mxMDR.rotate().setCoords(450, 70);
        MAR.setCoords(110, 200);
        MDR.setCoords(460, 200);
        MDROR.setCoords(413, 217);
        MDRbusAND.setCoords(452, 302);
        rdbusAND.setCoords(102, 402);
        wrbusAND.setCoords(452, 402);
        TSMAR.rotate(90).setCoords(152, 300);
        TSMDR.rotate(90).setCoords(502, 300);
        TSRDBUS.rotate(90).setCoords(152, 400);
        TSWRBUS.rotate(90).setCoords(502, 400);
    }

    private static void tabMEM1(){
        //Creating Stuff
        memory = new GMemory(0x10000, 8);
        MOr1 = new GOR();
        MOr2 = new GOR();
        MOr3 = new GOR();
        MTriState1 = new GMTriState(MRDBusOut, one);
        MTriState2 = new GMTriState(MWRBusOut, one);
        MTriState3 = new GMTriState(DROut, DFC);
        MRS1 = new GRSFlipFlop();
        MRS2 = new GRSFlipFlop();
        DR = new GRegister(8, 0, DOut);

        //Logics
        DBUS.registerSignal(MDBusOut);
        memory.setInput(MDBusOut);
        ABUS.registerSignal(MABusOut);
        memory.setAddress(MABusOut);
        DBUS.put(MTriState3Out);
        WRBUS.registerSignal(MWRBusOut);
        RDBUS.registerSignal(MRDBusOut);
        MTriState1.setResult(MTriState1Out).not();
        MTriState2.setResult(MTriState2Out).not();
        MRS1.setSSignal(MTriState2out).setRSignal(FC);
        MRS1.setResult(FWR);
        MRS2.setSSignal(MTriState1out).setRSignal(FC);
        MRS2.setResult(FRD);
        MOr1.add(MTriState2out).add(MTriState1out);
        MOr1.setResult(ldCNT);
        MOr2.add(MTriState2out).add(FWR);
        MOr2.setResult(MOr2Out);
        MOr3.add(MTriState1out).add(FRD);
        MOr3.setResult(MOr3Out);
        memory.setRdSignal(MOr3Out);
        memory.setWrSignal(MOr2Out);
        memory.setOutput(DOut);
        DR.setLoadSignal(FC);
        DR.setResult(DROut);
        MTriState3.setResult(MTriState3Out);

        //Coordinates
        memory.setCoords(500, 100);
        MTriState3.setCoords(720, 120);
        MTriState3.rotate(270);
        MTriState1.setCoords(100, 130);
        MTriState1.rotate(90);
        MTriState2.setCoords(180, 130);
        MTriState2.rotate(90);
        MRS1.setCoords(250, 168);
        MRS2.setCoords(250, 288);
        MOr1.setCoords(30, 250);
        MOr1.rotate(90);
        DR.setName("DR");
        DR.setCoords(520, 300);
        MOr2.setCoords(350, 165);
        MOr3.setCoords(350, 285);

    }

    private static void tabMEM2(){
        //Creating Stuff
        M2Or1 = new GOR();
        M2Or2 = new GOR();
        M2And = new GAND();
        M2DFF = new GDFlipFlop();
        CNT = new GCounter(3, 0, CNTIn);

        //Logics
        CNT.setLoadSignal(ldCNT);
        CNT.setDecSignal(decCNT);
        CNT.setResult(CNTOut);
        M2Or1.add(FRD).add(FWR);
        M2Or1.setResult(decCNT);
        M2Or2.add(CNTOut0).add(CNTOut1).add(CNTOut2);
        M2Or2.not();
        M2Or2.setResult(M2Or2Out);
        M2And.add(M2Or2Out).add(decCNT);
        M2And.setResult(FC);
        M2DFF.setDSignal(FC);
        M2DFF.setResult(DFC);
        //Coordinates
        CNT.setCoords(250, 100);
        M2Or1.setCoords(150, 140);
        M2Or2.setCoords(293, 200);
        M2Or2.rotate(90);
        M2And.setCoords(330, 250);
        M2DFF.setCoords(400, 250);
    }

    private static void tabCTRLUnit1(){
        CUAnd1 = new GAND();
        CUAnd2 = new GAND();
        CUOr = new GOR();
        CUInv = new GInverter(CUOrOut, CUInvOut);
        CUCNT = new GCounter(8, -1, CUMPOut);
        CUMP = new GMMultiplexer(8, 2);
        KMOP = new ClickableElement(24, "", 130, 200);
        KMBRANCH = new ClickableElement(25, "", 130, 200);
       
        //Logics
        CUMP.addIn(br).addIn(op);
        CUMP.addControl(brOPR);
        CUMP.setResult(CUMPOut);
        CUOr.add(brOPR).add(branch);
        CUOr.setResult(CUOrOut);
        CUAnd1.add(run).add(haltCompl).add(CUOrOut);
        CUAnd1.setResult(CUldCNT);
        CUAnd2.add(run).add(haltCompl).add(CUInvOut);
        CUAnd2.setResult(CUincCNT);
        CUCNT.setIncSignal(CUincCNT).setLoadSignal(CUldCNT).setResult(CUCNTOut);

        //Coordinates
        CUMP.setCoords(560, 70);
        CUCNT.setCoords(555, 360);
        
        KMOP.setCoords(70, 30);
        KMBRANCH.setCoords(320, 30);
       
        CUOr.setCoords(370, 365);
        CUAnd2.setCoords(495, 335);
        CUAnd1.setCoords(495, 395);
        CUInv.setCoords(CUAnd2.getLowerInv3Position().getX1(), CUAnd2.getLowerInv3Position().getY1());
    }

    private static void tabCTRLUnit2(){
        CUDC = new GBigDecoder(8, CUCNTOut);
        CTRLSignalsOP = new ClickableElement(26, "", 130, 130);
        CTRLSignalsCU = new ClickableElement(27, "", 150, 200);

        //Logics
        CUDC.setResult(CUDCOut);

        //Coordinates
        CUDC.setCoords(325, 50);
        CUDC.rotate();
        CTRLSignalsOP.setCoords(200, 230);
        CTRLSignalsCU.setCoords(450, 230);
    }

    private static void tabCUOPR(){
        //Create Stuff
        CUOPRCoder = new GEncoder(32);
        CUOPRMP = new GMMultiplexer(8, 32);
        CUOPRAND1 = new GAND();
        CUOPRAND2 = new GAND();
        CUOPRAND3 = new GAND();
        CUOPRAND4 = new GAND();
        CUOPRAND5 = new GAND();

        //Logics
        CUOPRAND1.add(OJO2).add(brOPR2).setResult(CUOPRAND1out);
        CUOPRAND2.add(PUSH2).add(brOPR2).setResult(CUOPRAND2out);
        CUOPRAND3.add(JMPIND2).add(brOPR2).setResult(CUOPRAND3out);
        CUOPRAND4.add(MOVS2).add(brOPR2).setResult(CUOPRAND4out);
        CUOPRAND5.add(ODO2).add(brOPR2).setResult(CUOPRAND5out);
        CUOPRCoder.add(CUOPRAND1out).add(CUOPRAND2out).add(CUOPRAND3out).add(CUOPRAND4out).add(CUOPRAND5out).add(RTI).add(RTS).add(CTRL).add(JSR).add(JMP).add(BNZ).add(INT).add(OJO).add(PUSH).add(POP).add(MOVS).add(MOVD).add(ODO).add(JMPIND).add(NOP).add(HALT);
        CUOPRCoder.setResult(CUOPRCoderOut);

        CUOPRMP.addIn(v34).addIn(v3E).addIn(v4F).addIn(v55).addIn(v61).addIn(v14).addIn(v16).addIn(v1D).addIn(v1F).addIn(v24).addIn(v28).addIn(v2D).addIn(v2F).addIn(v3C).addIn(v45).addIn(v53).addIn(v59).addIn(v5F).addIn(v66).addIn(vA8).addIn(vAA);
        CUOPRMP.addControl(CUOPRCoderOut0).addControl(CUOPRCoderOut1).addControl(CUOPRCoderOut2).addControl(CUOPRCoderOut3).addControl(CUOPRCoderOut4);
        CUOPRMP.setResult(op);

        //Coordinates
        CUOPRAND1.setCoords(70, 10);
        CUOPRAND2.setCoords(70, 55);
        CUOPRAND3.setCoords(70, 100);
        CUOPRAND4.setCoords(250, 10);
        CUOPRAND5.setCoords(250, 55);
        CUOPRCoder.setCoords(100, 150);
        CUOPRMP.setCoords(550, 68);
    }

    private static void tabCUBRANCH(){
        //Create Stuff
        CUBRANCHCoder = new GEncoder(32);
        CUBRANCHMP = new GMMultiplexer(8, 32);

        //Logics
        CUBRANCHCoder.add(val00).add(val0E).add(val0F).add(val12).add(val2B).add(val66).add(val6E).add(val72).add(val76).add(val7A).add(val7E).add(val86).add(val8C).add(val94).add(val95).add(val3A).add(val80).add(val85).add(val9A);
        CUBRANCHCoder.setResult(CUBRANCHCoderOut);

        CUBRANCHMP.addControl(CUBRANCHCoderOut0).addControl(CUBRANCHCoderOut1).addControl(CUBRANCHCoderOut2).addControl(CUBRANCHCoderOut3).addControl(CUBRANCHCoderOut4);
        CUBRANCHMP.addIn(v00).addIn(v0E).addIn(v0F).addIn(v12).addIn(v2B).addIn(v66).addIn(v6E).addIn(v72).addIn(v76).addIn(v7A).addIn(v7E).addIn(v86).addIn(v8C).addIn(v94).addIn(v95).addIn(v3A).addIn(v80).addIn(v85).addIn(v9A);
        CUBRANCHMP.setResult(br);
        //Coordinates
        CUBRANCHCoder.setCoords(100, 150);
        CUBRANCHMP.setCoords(550, 68);
    }

    private static void tabSignalsOP(){
        //Create stuff
        OPOR1 = new GOR();
        OPOR2 = new GOR();
        OPOR3 = new GOR();
        OPOR4 = new GOR();
        OPOR5 = new GOR();
        OPOR6 = new GOR();
        OPOR7 = new GOR();
        OPOR8 = new GOR();
        OPOR9 = new GOR();
        OPOR10 = new GOR();
        OPOR11 = new GOR();
        OPOR12 = new GOR();
        OPOR13 = new GOR();
        OPOR14 = new GOR();
        OPOR15 = new GOR();
        OPOR16 = new GOR();
        OPOR17 = new GOR();
        OPOR18 = new GOR();
        OPOR19 = new GOR();
        OPOR20 = new GOR();
        OPOR21 = new GOR();
        OPOR22 = new GOR();
        OPOR23 = new GOR();
        OPOR24 = new GOR();
        OPOR25 = new GOR();
        OPOR26 = new GOR();
        OPOR27 = new GOR();
        OPOR28 = new GOR();
        OPOR29 = new GOR();
        OPOR30 = new GOR();
        OPOR31 = new GOR();
        OPOR32 = new GOR();
        OPOR33 = new GOR();
        OPOR34 = new GOR();
        OPOR35 = new GOR();
        OPOR36 = new GOR();

        OPAND2 = new AND();
        OPAND12 = new AND();
        OPORrun = new OR();

        //Logics
        OPORrun.add(SyncOR2out).add(run).setResult(run_);
        OPAND2.add(run_).add(incMAR_).setResult(incMAR);
        OPAND12.add(run_).add(incSP_).setResult(incSP);
        OPOR1.add(T00).add(T12).add(T20).add(T22).add(T36).add(T3F).add(T41).add(T45).add(T6B).add(T6F).add(T73).add(T77).add(T7B).add(T7F).add(T86).add(T8D).add(T92).add(T94).add(T9B).add(T9D).add(T9F).add(TA1).setResult(ldMAR);
        OPOR2.add(T02).add(T06).add(T0A).add(T14).add(T16).add(T38).add(T46).add(T81).add(T88).add(T8F).add(T96).add(TA3).setResult(incMAR_);
        OPOR3.add(T12).add(T20).add(T22).add(T36).add(T3F).add(T41).add(T45).add(T92).add(T9B).add(T9D).add(T9F).add(TA1).setResult(mxMAR0);
        OPOR4.add(T6B).add(T6F).add(T73).add(T77).add(T7B).add(T7F).add(T8D).add(T92).add(T94).add(TA1).setResult(mxMAR1);
        OPOR5.add(T36).add(T86).add(T92).setResult(mxMAR2);
        OPOR6.add(T1F).add(T22).add(T36).add(T38).add(T3E).add(T41).add(T4A).add(T5A).add(T92).add(T96).add(T9A).add(T9D).add(T9F).setResult(ldMDR);
        OPOR7.add(T1F).add(T36).add(T41).add(T4A).add(T5A).add(T92).add(T9A).add(T9F).setResult(mxMDR0);
        OPOR8.add(T22).add(T36).add(T3E).add(T96).add(T9F).setResult(mxMDR1);
        OPOR9.add(T1F).add(T22).add(T38).add(T9A).add(T9D).add(T9F).setResult(mxMDR2);
        OPOR10.add(T01).add(T05).add(T09).add(T0C).add(T14).add(T16).add(T18).add(T46).add(T48).add(T80).add(T82).add(T87).add(T89).add(T8E).add(T90).add(TA2).add(TA4).setResult(read);
        OPOR11.add(T21).add(T23).add(T37).add(T39).add(T40).add(T42).add(T95).add(T97).add(T9C).add(T9E).add(TA0).setResult(write);
        OPOR12.add(T14).add(T16).add(T17).add(T46).add(T47).setResult(incSP_);
        OPOR13.add(T1F).add(T20).add(T3E).add(T3F).add(T9A).add(T9B).add(T9D).setResult(decSP);
        OPOR14.add(T0F).add(T19).add(T24).add(T29).add(T4F).add(TA3).setResult(ldPCL);
        OPOR15.add(T0F).add(T17).add(T24).add(T29).add(T4F).add(TA5).setResult(ldPCH);
        OPOR16.add(T10).add(T1A).add(T25).add(T2A).add(T50).add(TA6).setResult(ldPC);
        OPOR17.add(T0F).add(T17).add(T19).add(T4F).add(TA3).add(TA5).setResult(mxPC0);
        OPOR18.add(T0F).add(T24).setResult(mxPC1);
        OPOR19.add(T29).add(T4F).setResult(mxPC2);
        OPOR20.add(T02).add(T06).add(T0A).add(T0D).setResult(incPC);
        OPOR21.add(T73).add(T76).add(T7A).add(T7B).setResult(R0);
        OPOR22.add(T6B).add(T6F).add(T73).add(T77).add(T7B).setResult(R1);
        T6B.link(R2);
        OPOR23.add(T6B).add(T6E).add(T6F).add(T72).add(T73).add(T76).add(T77).add(T7A).add(T7B).setResult(R3);
        T56.link(R4);
        OPOR24.add(T4C).add(T5C).setResult(R5);
        OPOR25.add(T56).add(T59).add(T61).add(T63).setResult(R6);
        OPOR26.add(T6F).add(T73).add(T77).add(T7B).setResult(R7);
        OPOR27.add(T30).add(T3D).add(T49).add(T54).add(T59).add(T60).add(T83).add(T8A).setResult(ldXL);
        OPOR28.add(T30).add(T3D).add(T47).add(T54).add(T59).add(T60).add(T81).add(T88).setResult(ldXH);
        OPOR29.add(T61).add(T91).setResult(ldYL);
        OPOR30.add(T61).add(T8F).setResult(ldYH);
        T55.link(transX);
        OPOR31.add(T35).add(T55).setResult(ldTEMP);
        OPOR32.add(T31).add(T34).setResult(aluOJO);
        T62.link(aluODO);
        OPOR33.add(T31).add(T34).add(T62).setResult(ldFLAGS);
        OPOR34.add(T32).add(T4C).add(T56).add(T5C).add(T63).setResult(ldREG);
        T02.link(ldINTEXT);
        T00.link(ldADRTMP);
        T02.link(ldIR1);
        T06.link(ldIR2);
        T0A.link(ldIR3);
        T0D.link(ldIR4);
        T2D.link(stPRINT);
        T0F.link(ldPRADROPR);
        T1D.link(ldCONTROL);
        T15.link(PSWin);
        TA1.link(ack);
        OPOR35.add(T6B).add(T6F).add(T73).add(T77).add(T7B).add(T7F).setResult(ldTD);
        OPOR36.add(T6E).add(T72).add(T76).add(T7A).setResult(ldTM);

        //Coordinates
        OPOR1.setCoords(40, 115);
        OPOR2.setCoords(40, 305);
        OPOR3.setCoords(40, 437);
        OPOR4.setCoords(150, 50);
        OPOR5.setCoords(150, 130);
        OPOR6.setCoords(150, 230);
        OPOR7.setCoords(150, 355);
        OPOR8.setCoords(150, 435);
        OPOR9.setCoords(260, 30);
        OPOR10.setCoords(260, 160);
        OPOR11.setCoords(260, 320);
        OPOR12.setCoords(260, 420);
        OPOR13.setCoords(370, 40);
        OPOR14.setCoords(370, 120);
        OPOR15.setCoords(370, 200);
        OPOR16.setCoords(370, 280);
        OPOR17.setCoords(370, 360);
        OPOR18.setCoords(370, 420);
        OPOR19.setCoords(370, 460);
        OPOR20.setCoords(480, 20);
        OPOR21.setCoords(480, 80);
        OPOR22.setCoords(480, 140);//
        OPOR23.setCoords(480, 250);//
        OPOR24.setCoords(480, 345);
        OPOR25.setCoords(480, 395);
        OPOR26.setCoords(480, 455);
        OPOR27.setCoords(590, 45);
        OPOR28.setCoords(590, 145);// // //
        OPOR29.setCoords(590, 210);
        OPOR30.setCoords(590, 250);
        OPOR31.setCoords(590, 310);
        OPOR32.setCoords(590, 350);//
        OPOR33.setCoords(590, 420);
        OPOR34.setCoords(700, 30);//...
        OPOR35.setCoords(700, 375);
        OPOR36.setCoords(700, 445);
    }

    private static void tabSignalsCU(){
        //Create Stuff
        SCUAND1 = new GAND();
        SCUAND2 = new GAND();
        SCUAND3 = new GAND();
        SCUAND4 = new GAND();
        SCUAND5 = new GAND();
        SCUAND6 = new GAND();
        SCUAND7 = new GAND();
        SCUAND8 = new GAND();
        SCUAND9 = new GAND();
        SCUAND10 = new GAND();
        SCUAND11 = new GAND();
        SCUAND12 = new GAND();
        SCUAND13 = new GAND();
        SCUAND14 = new GAND();
        SCUAND15 = new GAND();
        SCUAND16 = new GAND();
        SCUAND17 = new GAND();
        SCOR1 = new GOR();
        SCOR2 = new GOR();
        SCOR3 = new GOR();
        SCOR4 = new GOR();
        SCOR5 = new GOR();
        SCOR6 = new GOR();
        SCOR7 = new GOR();
        SCOR8 = new GOR();
        SCOR9 = new GOR();
        SCOR10 = new GOR();
        SCOR11 = new GOR();
        SCOR12 = new GOR();
        SCOR13 = new GOR();
        SCOR14 = new GOR();
        SCOR15 = new GOR();
        SCInv1 = new GInverter(cond, condCompl);
        SCInv2 = new GInverter(regdir, regCompl);
        SCInv3 = new GInverter(immreg, immregCompl);
        SCInv4 = new GInverter(memind, memindCompl);
        SCInv5 = new GInverter(regip, regipCompl);
        SCInv6 = new GInverter(NAD, NADCompl);

        //Logics
        //Samo linkovani
        T0E.link(brOPR1);
        T85.link(brOPR2);
        T04.link(val12);
        T28.link(val2B);
        T33.link(val3A);
        T67.link(val6E);
        T68.link(val72);
        T69.link(val76);
        T6A.link(val7A);
        T66.link(val7E);
        T8B.link(val85);
        T84.link(val86);
        T7E.link(val8C);
        T8C.link(val94);
        T04.link(brL1);
        T08.link(brL2);
        T0B.link(brL3);
        T28.link(brnotCOND);
        T8C.link(brnotmemind);
        T84.link(brmemind);
        T66.link(brnotregip);
        T67.link(brbxsi);
        T68.link(brbxdi);
        T69.link(brbpsi);
        T6A.link(brbpdi);
        T7E.link(brnotNAD);

        SCUAND1.add(brgrADROPR).add(grADROPR).setResult(SCUAND1Out);
        SCUAND2.add(brL1).add(L1).setResult(SCUAND2Out);
        SCUAND3.add(brL2).add(L2).setResult(SCUAND3Out);
        SCUAND4.add(brL3).add(L3).setResult(SCUAND4Out);
        SCUAND5.add(brnotPREKID).add(PREKIDCompl).setResult(SCUAND5Out);
        SCUAND6.add(brnotCOND).add(condCompl).setResult(SCUAND6Out);
        SCUAND7.add(brnotreg).add(regCompl).setResult(SCUAND7Out);
        SCUAND8.add(brnotimmreg).add(immregCompl).setResult(SCUAND8Out);
        SCUAND9.add(brnotmemind).add(memindCompl).setResult(SCUAND9Out);
        SCUAND10.add(brmemind).add(memind).setResult(SCUAND10Out);
        SCUAND11.add(brnotregip).add(regipCompl).setResult(SCUAND11Out);
        SCUAND12.add(brbxsi).add(bxsi).setResult(SCUAND12Out);
        SCUAND13.add(brbxdi).add(bxdi).setResult(SCUAND13Out);
        SCUAND14.add(brbpsi).add(bpsi).setResult(SCUAND14Out);
        SCUAND15.add(brbpdi).add(bpdi).setResult(SCUAND15Out);
        SCUAND16.add(brNAD2).add(NAD2).setResult(SCUAND16Out);
        SCUAND17.add(brnotNAD).add(NADCompl).setResult(SCUAND17Out);

        SCOR1.add(bruncnd).add(SCUAND1Out).add(SCUAND2Out).add(SCUAND3Out).add(SCUAND4Out).add(SCUAND5Out).add(SCUAND6Out).add(SCUAND7Out).add(SCUAND8Out).add(SCUAND9Out).add(SCUAND10Out).add(SCUAND11Out).add(SCUAND12Out).add(SCUAND13Out).add(SCUAND14Out).add(SCUAND15Out).add(SCUAND16Out).add(SCUAND17Out);
        SCOR1.setResult(branch);

        SCOR2.add(T1B).add(T1E).add(T26).add(T2B).add(T3A).add(T43).add(T4D).add(T51).add(T57).add(T5D).add(T64).add(T98).add(TA7).add(TA9);
        SCOR2.setResult(val00);

        SCOR3.add(T08).add(T0B).add(T13);
        SCOR3.setResult(val0E);

        SCOR4.add(T03).add(T07);
        SCOR4.setResult(val0F);

        SCOR5.add(T2F).add(T3C).add(T4B).add(T53).add(T5B).add(T5F);
        SCOR5.setResult(val66);

        SCOR6.add(T6D).add(T71).add(T75).add(T79).add(T7D);
        SCOR6.setResult(val80);

        SCOR7.add(T6C).add(T70).add(T74).add(T78).add(T7C).add(T93);
        SCOR7.setResult(val95);

        SCOR8.add(T11).add(T1C).add(T27).add(T2C).add(T2E).add(T3B).add(T44).add(T4E).add(T52).add(T58).add(T5E).add(T65).add(T99);
        SCOR8.setResult(val9A);

        SCOR9.add(T11).add(T13).add(T1C).add(T1E).add(T27).add(T2C).add(T2E).add(T33).add(T3B).add(T44).add(T4E).add(T52).add(T58).add(T5E).add(T65).add(T6D).add(T71).add(T75).add(T79).add(T7D).add(T8B).add(T93).add(T99).add(TA7).add(TA9);
        SCOR9.setResult(bruncnd);

        SCOR10.add(T03).add(T07);
        SCOR10.setResult(brgrADROPR);

        SCOR11.add(T1B).add(T26).add(T2B).add(T3A).add(T43).add(T4D).add(T51).add(T57).add(T5D).add(T64).add(T98).add(TA8);
        SCOR11.setResult(brnotPREKID);

        SCOR12.add(T2F).add(T4B).add(T5B);
        SCOR12.setResult(brnotreg);

        SCOR13.add(T3C).add(T53).add(T5F);
        SCOR13.setResult(brnotimmreg);

        SCOR14.add(T6C).add(T70).add(T74).add(T78).add(T7C);
        SCOR14.setResult(brNAD2);

        SCOR15.add(brOPR1).add(brOPR2);
        SCOR15.setResult(brOPR);
        //Coordinates
        

        SCUAND1.setCoords(80, 25);
        SCUAND2.setCoords(80, 75);
        SCUAND3.setCoords(80, 125);
        SCUAND4.setCoords(80, 175);
        SCUAND5.setCoords(80, 225);

        SCUAND6.setCoords(80, 275);
        SCUAND7.setCoords(80, 325);
        SCUAND8.setCoords(80, 375);
        SCUAND9.setCoords(80, 425);
        SCUAND10.setCoords(220, 25);

        SCUAND11.setCoords(220, 75);
        SCUAND12.setCoords(220, 125);
        SCUAND13.setCoords(220, 175);
        SCUAND14.setCoords(220, 225);
        SCUAND15.setCoords(220, 275);

        SCUAND16.setCoords(220, 325);
        SCUAND17.setCoords(220, 375);

        SCInv1.setCoords(SCUAND6.getLowerInv2Position().getX1(), SCUAND6.getLowerInv2Position().getY1());
        SCInv2.setCoords(SCUAND7.getLowerInv2Position().getX1(), SCUAND7.getLowerInv2Position().getY1());
        SCInv3.setCoords(SCUAND8.getLowerInv2Position().getX1(), SCUAND8.getLowerInv2Position().getY1());
        SCInv4.setCoords(SCUAND9.getLowerInv2Position().getX1(), SCUAND9.getLowerInv2Position().getY1());
        SCInv5.setCoords(SCUAND11.getLowerInv2Position().getX1(), SCUAND11.getLowerInv2Position().getY1());
        SCInv6.setCoords(SCUAND17.getLowerInv2Position().getX1(), SCUAND17.getLowerInv2Position().getY1());

        SCOR1.setCoords(320, 155);
        SCOR2.setCoords(320, 345);
        SCOR3.setCoords(420, 395);
        SCOR4.setCoords(420, 440);
        SCOR5.setCoords(420, 50);
        SCOR6.setCoords(420, 120);
        SCOR7.setCoords(420, 190);
        SCOR8.setCoords(420, 300);
        SCOR9.setCoords(520, 150);
        SCOR10.setCoords(520, 310);
        SCOR11.setCoords(520, 395);
        SCOR12.setCoords(645, 150);
        SCOR13.setCoords(645, 230);
        SCOR14.setCoords(645, 310);
        SCOR15.setCoords(645, 420);
    }

    private static void createTSignals() {
        T00 = new GSignal(0,"T00", true);
        T01 = new GSignal(0,"T01", true);
        T02 = new GSignal(0,"T02", true);
        T03 = new GSignal(0,"T03", true);
        T04 = new GSignal(0,"T04", true);
        T05 = new GSignal(0,"T05", true);
        T06 = new GSignal(0,"T06", true);
        T07 = new GSignal(0,"T07", true);
        T08 = new GSignal(0,"T08", true);
        T09 = new GSignal(0,"T09", true);
        T0A = new GSignal(0,"T0A", true);
        T0B = new GSignal(0,"T0B", true);
        T0C = new GSignal(0,"T0C", true);
        T0D = new GSignal(0,"T0D", true);
        T0E = new GSignal(0,"T0E", true);
        T0F = new GSignal(0,"T0F", true);
        T10 = new GSignal(0,"T10", true);
        T11 = new GSignal(0,"T11", true);
        T12 = new GSignal(0,"T12", true);
        T13 = new GSignal(0,"T13", true);
        T14 = new GSignal(0,"T14", true);
        T15 = new GSignal(0,"T15", true);
        T16 = new GSignal(0,"T16", true);
        T17 = new GSignal(0,"T17", true);
        T18 = new GSignal(0,"T18", true);
        T19 = new GSignal(0,"T19", true);
        T1A = new GSignal(0,"T1A", true);
        T1B = new GSignal(0,"T1B", true);
        T1C = new GSignal(0,"T1C", true);
        T1D = new GSignal(0,"T1D", true);
        T1E = new GSignal(0,"T1E", true);
        T1F = new GSignal(0,"T1F", true);
        T20 = new GSignal(0,"T20", true);
        T21 = new GSignal(0,"T21", true);
        T22 = new GSignal(0,"T22", true);
        T23 = new GSignal(0,"T23", true);
        T24 = new GSignal(0,"T24", true);
        T25 = new GSignal(0,"T25", true);
        T26 = new GSignal(0,"T26", true);
        T27 = new GSignal(0,"T27", true);
        T28 = new GSignal(0,"T28", true);
        T29 = new GSignal(0,"T29", true);
        T2A = new GSignal(0,"T2A", true);
        T2B = new GSignal(0,"T2B", true);
        T2C = new GSignal(0,"T2C", true);
        T2D = new GSignal(0,"T2D", true);
        T2E = new GSignal(0,"T2E", true);
        T2F = new GSignal(0,"T2F", true);
        T30 = new GSignal(0,"T30", true);
        T31 = new GSignal(0,"T31", true);
        T32 = new GSignal(0,"T32", true);
        T33 = new GSignal(0,"T33", true);
        T34 = new GSignal(0,"T34", true);
        T35 = new GSignal(0,"T35", true);
        T36 = new GSignal(0,"T36", true);
        T37 = new GSignal(0,"T37", true);
        T38 = new GSignal(0,"T38", true);
        T39 = new GSignal(0,"T39", true);
        T3A = new GSignal(0,"T3A", true);
        T3B = new GSignal(0,"T3B", true);
        T3C = new GSignal(0,"T3C", true);
        T3D = new GSignal(0,"T3D", true);
        T3E = new GSignal(0,"T3E", true);
        T3F = new GSignal(0,"T3F", true);
        T40 = new GSignal(0,"T40", true);
        T41 = new GSignal(0,"T41", true);
        T42 = new GSignal(0,"T42", true);
        T43 = new GSignal(0,"T43", true);
        T44 = new GSignal(0,"T44", true);
        T45 = new GSignal(0,"T45", true);
        T46 = new GSignal(0,"T46", true);
        T47 = new GSignal(0,"T47", true);
        T48 = new GSignal(0,"T48", true);
        T49 = new GSignal(0,"T49", true);
        T4A = new GSignal(0,"T4A", true);
        T4B = new GSignal(0,"T4B", true);
        T4C = new GSignal(0,"T4C", true);
        T4D = new GSignal(0,"T4D", true);
        T4E = new GSignal(0,"T4E", true);
        T4F = new GSignal(0,"T4F", true);
        T50 = new GSignal(0,"T50", true);
        T51 = new GSignal(0,"T51", true);
        T52 = new GSignal(0,"T52", true);
        T53 = new GSignal(0,"T53", true);
        T54 = new GSignal(0,"T54", true);
        T55 = new GSignal(0,"T55", true);
        T56 = new GSignal(0,"T56", true);
        T57 = new GSignal(0,"T57", true);
        T58 = new GSignal(0,"T58", true);
        T59 = new GSignal(0,"T59", true);
        T5A = new GSignal(0,"T5A", true);
        T5B = new GSignal(0,"T5B", true);
        T5C = new GSignal(0,"T5C", true);
        T5D = new GSignal(0,"T5D", true);
        T5E = new GSignal(0,"T5E", true);
        T5F = new GSignal(0,"T5F", true);
        T60 = new GSignal(0,"T60", true);
        T61 = new GSignal(0,"T61", true);
        T62 = new GSignal(0,"T62", true);
        T63 = new GSignal(0,"T63", true);
        T64 = new GSignal(0,"T64", true);
        T65 = new GSignal(0,"T65", true);
        T66 = new GSignal(0,"T66", true);
        T67 = new GSignal(0,"T67", true);
        T68 = new GSignal(0,"T68", true);
        T69 = new GSignal(0,"T69", true);
        T6A = new GSignal(0,"T6A", true);
        T6B = new GSignal(0,"T6B", true);
        T6C = new GSignal(0,"T6C", true);
        T6D = new GSignal(0,"T6D", true);
        T6E = new GSignal(0,"T6E", true);
        T6F = new GSignal(0,"T6F", true);
        T70 = new GSignal(0,"T70", true);
        T71 = new GSignal(0,"T71", true);
        T72 = new GSignal(0,"T72", true);
        T73 = new GSignal(0,"T73", true);
        T74 = new GSignal(0,"T74", true);
        T75 = new GSignal(0,"T75", true);
        T76 = new GSignal(0,"T76", true);
        T77 = new GSignal(0,"T77", true);
        T78 = new GSignal(0,"T78", true);
        T79 = new GSignal(0,"T79", true);
        T7A = new GSignal(0,"T7A", true);
        T7B = new GSignal(0,"T7B", true);
        T7C = new GSignal(0,"T7C", true);
        T7D = new GSignal(0,"T7D", true);
        T7E = new GSignal(0,"T7E", true);
        T7F = new GSignal(0,"T7F", true);
        T80 = new GSignal(0,"T80", true);
        T81 = new GSignal(0,"T81", true);
        T82 = new GSignal(0,"T82", true);
        T83 = new GSignal(0,"T83", true);
        T84 = new GSignal(0,"T84", true);
        T85 = new GSignal(0,"T85", true);
        T86 = new GSignal(0,"T86", true);
        T87 = new GSignal(0,"T87", true);
        T88 = new GSignal(0,"T88", true);
        T89 = new GSignal(0,"T89", true);
        T8A = new GSignal(0,"T8A", true);
        T8B = new GSignal(0,"T8B", true);
        T8C = new GSignal(0,"T8C", true);
        T8D = new GSignal(0,"T8D", true);
        T8E = new GSignal(0,"T8E", true);
        T8F = new GSignal(0,"T8F", true);
        T90 = new GSignal(0,"T90", true);
        T91 = new GSignal(0,"T91", true);
        T92 = new GSignal(0,"T92", true);
        T93 = new GSignal(0,"T93", true);
        T94 = new GSignal(0,"T94", true);
        T95 = new GSignal(0,"T95", true);
        T96 = new GSignal(0,"T96", true);
        T97 = new GSignal(0,"T97", true);
        T98 = new GSignal(0,"T98", true);
        T99 = new GSignal(0,"T99", true);
        T9A = new GSignal(0,"T9A", true);
        T9B = new GSignal(0,"T9B", true);
        T9C = new GSignal(0,"T9C", true);
        T9D = new GSignal(0,"T9D", true);
        T9E = new GSignal(0,"T9E", true);
        T9F = new GSignal(0,"T9F", true);
        TA0 = new GSignal(0,"TA0", true);
        TA1 = new GSignal(0,"TA1", true);
        TA2 = new GSignal(0,"TA2", true);
        TA3 = new GSignal(0,"TA3", true);
        TA4 = new GSignal(0,"TA4", true);
        TA5 = new GSignal(0,"TA5", true);
        TA6 = new GSignal(0,"TA6", true);
        TA7 = new GSignal(0,"TA7", true);
        TA8 = new GSignal(0,"TA8", true);
        TA9 = new GSignal(0,"TA9", true);
    }

    private static void createVAL(){
        val00 = new GSignal(0,"val00", true);
        val0E = new GSignal(0,"val0E", true);
        val0F = new GSignal(0,"val0F", true);
        val12 = new GSignal(0,"val12", true);
        val2B = new GSignal(0,"val2B", true);
        val3A = new GSignal(0,"val3A", true);
        val66 = new GSignal(0,"val66", true);
        val6E = new GSignal(0,"val6E", true);
        val72 = new GSignal(0,"val72", true);
        val76 = new GSignal(0,"val76", true);
        val7A = new GSignal(0,"val7A", true);
        val7E = new GSignal(0,"val7E", true);
        val80 = new GSignal(0,"val80", true);
        val85 = new GSignal(0,"val85", true);
        val86 = new GSignal(0,"val86", true);
        val8C = new GSignal(0,"val8C", true);
        val94 = new GSignal(0,"val94", true);
        val95 = new GSignal(0,"val95", true);
        val9A = new GSignal(0,"val9A", true);
    }

    private static void createVSigs(){
        v00 = new GMSignal(8, 0x00);
        v0E = new GMSignal(8, 0x0E);
        v0F = new GMSignal(8, 0x0F);
        v12 = new GMSignal(8, 0x12);
        v2B = new GMSignal(8, 0x2B);
        v6E = new GMSignal(8, 0x6E);
        v72 = new GMSignal(8, 0x72);
        v76 = new GMSignal(8, 0x76);
        v7A = new GMSignal(8, 0x7A);
        v7E = new GMSignal(8, 0x7E);
        v86 = new GMSignal(8, 0x86);
        v8C = new GMSignal(8, 0x8C);
        v94 = new GMSignal(8, 0x94);
        v95 = new GMSignal(8, 0x95);
        v3A = new GMSignal(8, 0x3A);
        v80 = new GMSignal(8, 0x80);
        v85 = new GMSignal(8, 0x85);
        v9A = new GMSignal(8, 0x9A);
        v14 = new GMSignal(8, 0x14);
        v16 = new GMSignal(8, 0x16);
        v1D = new GMSignal(8, 0x1D);
        v1F = new GMSignal(8, 0x1F);
        v24 = new GMSignal(8, 0x24);
        v28 = new GMSignal(8, 0x28);
        v2D = new GMSignal(8, 0x2D);
        v2F = new GMSignal(8, 0x2F);
        v3C = new GMSignal(8, 0x3C);
        v45 = new GMSignal(8, 0x45);
        v53 = new GMSignal(8, 0x53);
        v59 = new GMSignal(8, 0x59);
        v5F = new GMSignal(8, 0x5F);
        v66 = new GMSignal(8, 0x66);
        vA8 = new GMSignal(8, 0xA8);
        vAA = new GMSignal(8, 0xAA);
        v34 = new GMSignal(8, 0x34);
        v3E = new GMSignal(8, 0x3E);
        v4F = new GMSignal(8, 0x4F);
        v55 = new GMSignal(8, 0x55);
        v61 = new GMSignal(8, 0x61);
    }

    public static void resetDesign(){
        ArrayList<Signal> regsigs = SignalRegistry.getSignals();
        Iterator iter = regsigs.iterator();
        while(iter.hasNext()){
            Signal tempsig = (Signal)iter.next();
            tempsig.set(SignalRegistry.getValues(tempsig).get(0)); // vrati na pocetnu vrednost
        }
    }
}